Queue is unavailable but no exception is thrown in the processor of a Camel










0















I have a processor in a camel which is sending message to an endpoint in the camel (apache camel).



I have an endpoint in the camel xml file:



<endpoint id="sendQueue" uri="FBActiveMQ:queue:SEND_Q" />


I made the queue sendQueue deleted from the queuemanager (Using IBM MQ) and I tried to send a message from the processor to this queue and catch an exception and handle it in the processor itself.



The thing is, I never get an exception when the message is sent to the deleted queue.



I am aware that I can have exception handler in the camel file itself but I cannot do so because my processor is doing a transaction inside a transaction boundary and needs to rollback in case of queue failure.



Do you have any clues please?



The code which is written is like this(not the exact code) .



 try
JmsProducer jmsProducer = new JmsProducer(endPoint);
jmsProducer.start();
Exchange exchange = endPoint.createExchange(ExchangePattern.InOnly);
exchange.getIn().setBody(msg);
jmsProducer.process(exchange);
catch(Exception e)
e.printStackTrace();











share|improve this question
























  • Is your code working if queue is not deleted? Does the queue receive the messages properly?

    – Ankur Chrungoo
    Nov 15 '18 at 15:52











  • @ Ankur Chrungoo . yes its working correctly if the queues are not deleted. The only problem is my code is not able to rollback a database transaction in case if its not able to send message to the queue(scenarios like queue is deleted). In expected scenario if the code is not able to send to the queue then it must rollback the transaction.

    – xpioneer
    Nov 15 '18 at 18:20











  • What type of exception are you catching ?

    – Ankur Chrungoo
    Nov 15 '18 at 18:26











  • @Ankur Chrungoo I have made the catch block to expect any type of Exception class because I am not sure of the type of exception its going to throw.

    – xpioneer
    Nov 15 '18 at 18:35











  • Sounds about right! May be posting your code will help.

    – Ankur Chrungoo
    Nov 15 '18 at 18:38















0















I have a processor in a camel which is sending message to an endpoint in the camel (apache camel).



I have an endpoint in the camel xml file:



<endpoint id="sendQueue" uri="FBActiveMQ:queue:SEND_Q" />


I made the queue sendQueue deleted from the queuemanager (Using IBM MQ) and I tried to send a message from the processor to this queue and catch an exception and handle it in the processor itself.



The thing is, I never get an exception when the message is sent to the deleted queue.



I am aware that I can have exception handler in the camel file itself but I cannot do so because my processor is doing a transaction inside a transaction boundary and needs to rollback in case of queue failure.



Do you have any clues please?



The code which is written is like this(not the exact code) .



 try
JmsProducer jmsProducer = new JmsProducer(endPoint);
jmsProducer.start();
Exchange exchange = endPoint.createExchange(ExchangePattern.InOnly);
exchange.getIn().setBody(msg);
jmsProducer.process(exchange);
catch(Exception e)
e.printStackTrace();











share|improve this question
























  • Is your code working if queue is not deleted? Does the queue receive the messages properly?

    – Ankur Chrungoo
    Nov 15 '18 at 15:52











  • @ Ankur Chrungoo . yes its working correctly if the queues are not deleted. The only problem is my code is not able to rollback a database transaction in case if its not able to send message to the queue(scenarios like queue is deleted). In expected scenario if the code is not able to send to the queue then it must rollback the transaction.

    – xpioneer
    Nov 15 '18 at 18:20











  • What type of exception are you catching ?

    – Ankur Chrungoo
    Nov 15 '18 at 18:26











  • @Ankur Chrungoo I have made the catch block to expect any type of Exception class because I am not sure of the type of exception its going to throw.

    – xpioneer
    Nov 15 '18 at 18:35











  • Sounds about right! May be posting your code will help.

    – Ankur Chrungoo
    Nov 15 '18 at 18:38













0












0








0








I have a processor in a camel which is sending message to an endpoint in the camel (apache camel).



I have an endpoint in the camel xml file:



<endpoint id="sendQueue" uri="FBActiveMQ:queue:SEND_Q" />


I made the queue sendQueue deleted from the queuemanager (Using IBM MQ) and I tried to send a message from the processor to this queue and catch an exception and handle it in the processor itself.



The thing is, I never get an exception when the message is sent to the deleted queue.



I am aware that I can have exception handler in the camel file itself but I cannot do so because my processor is doing a transaction inside a transaction boundary and needs to rollback in case of queue failure.



Do you have any clues please?



The code which is written is like this(not the exact code) .



 try
JmsProducer jmsProducer = new JmsProducer(endPoint);
jmsProducer.start();
Exchange exchange = endPoint.createExchange(ExchangePattern.InOnly);
exchange.getIn().setBody(msg);
jmsProducer.process(exchange);
catch(Exception e)
e.printStackTrace();











share|improve this question
















I have a processor in a camel which is sending message to an endpoint in the camel (apache camel).



I have an endpoint in the camel xml file:



<endpoint id="sendQueue" uri="FBActiveMQ:queue:SEND_Q" />


I made the queue sendQueue deleted from the queuemanager (Using IBM MQ) and I tried to send a message from the processor to this queue and catch an exception and handle it in the processor itself.



The thing is, I never get an exception when the message is sent to the deleted queue.



I am aware that I can have exception handler in the camel file itself but I cannot do so because my processor is doing a transaction inside a transaction boundary and needs to rollback in case of queue failure.



Do you have any clues please?



The code which is written is like this(not the exact code) .



 try
JmsProducer jmsProducer = new JmsProducer(endPoint);
jmsProducer.start();
Exchange exchange = endPoint.createExchange(ExchangePattern.InOnly);
exchange.getIn().setBody(msg);
jmsProducer.process(exchange);
catch(Exception e)
e.printStackTrace();








java apache-camel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 7:44









geisterfurz007

2,46222034




2,46222034










asked Nov 15 '18 at 14:23









xpioneerxpioneer

400310




400310












  • Is your code working if queue is not deleted? Does the queue receive the messages properly?

    – Ankur Chrungoo
    Nov 15 '18 at 15:52











  • @ Ankur Chrungoo . yes its working correctly if the queues are not deleted. The only problem is my code is not able to rollback a database transaction in case if its not able to send message to the queue(scenarios like queue is deleted). In expected scenario if the code is not able to send to the queue then it must rollback the transaction.

    – xpioneer
    Nov 15 '18 at 18:20











  • What type of exception are you catching ?

    – Ankur Chrungoo
    Nov 15 '18 at 18:26











  • @Ankur Chrungoo I have made the catch block to expect any type of Exception class because I am not sure of the type of exception its going to throw.

    – xpioneer
    Nov 15 '18 at 18:35











  • Sounds about right! May be posting your code will help.

    – Ankur Chrungoo
    Nov 15 '18 at 18:38

















  • Is your code working if queue is not deleted? Does the queue receive the messages properly?

    – Ankur Chrungoo
    Nov 15 '18 at 15:52











  • @ Ankur Chrungoo . yes its working correctly if the queues are not deleted. The only problem is my code is not able to rollback a database transaction in case if its not able to send message to the queue(scenarios like queue is deleted). In expected scenario if the code is not able to send to the queue then it must rollback the transaction.

    – xpioneer
    Nov 15 '18 at 18:20











  • What type of exception are you catching ?

    – Ankur Chrungoo
    Nov 15 '18 at 18:26











  • @Ankur Chrungoo I have made the catch block to expect any type of Exception class because I am not sure of the type of exception its going to throw.

    – xpioneer
    Nov 15 '18 at 18:35











  • Sounds about right! May be posting your code will help.

    – Ankur Chrungoo
    Nov 15 '18 at 18:38
















Is your code working if queue is not deleted? Does the queue receive the messages properly?

– Ankur Chrungoo
Nov 15 '18 at 15:52





Is your code working if queue is not deleted? Does the queue receive the messages properly?

– Ankur Chrungoo
Nov 15 '18 at 15:52













@ Ankur Chrungoo . yes its working correctly if the queues are not deleted. The only problem is my code is not able to rollback a database transaction in case if its not able to send message to the queue(scenarios like queue is deleted). In expected scenario if the code is not able to send to the queue then it must rollback the transaction.

– xpioneer
Nov 15 '18 at 18:20





@ Ankur Chrungoo . yes its working correctly if the queues are not deleted. The only problem is my code is not able to rollback a database transaction in case if its not able to send message to the queue(scenarios like queue is deleted). In expected scenario if the code is not able to send to the queue then it must rollback the transaction.

– xpioneer
Nov 15 '18 at 18:20













What type of exception are you catching ?

– Ankur Chrungoo
Nov 15 '18 at 18:26





What type of exception are you catching ?

– Ankur Chrungoo
Nov 15 '18 at 18:26













@Ankur Chrungoo I have made the catch block to expect any type of Exception class because I am not sure of the type of exception its going to throw.

– xpioneer
Nov 15 '18 at 18:35





@Ankur Chrungoo I have made the catch block to expect any type of Exception class because I am not sure of the type of exception its going to throw.

– xpioneer
Nov 15 '18 at 18:35













Sounds about right! May be posting your code will help.

– Ankur Chrungoo
Nov 15 '18 at 18:38





Sounds about right! May be posting your code will help.

– Ankur Chrungoo
Nov 15 '18 at 18:38












1 Answer
1






active

oldest

votes


















0














Have you tried checking the exchange object after the process call in your try block to see if it's got an exception in it.



jmsProducer.process(exchange);
if (exchange.getException() != null)
exchange.getException().printStackTrace();;



I think you'll only get an exception thrown if it's something wrong with your jmsProducer (e.g. no camelContext).



... deleted bit about Exchange/Exception typo in original example ...






share|improve this answer

























  • thanks @pcoates for pointing it out. Actually this is not the exact code I had written. Due to my companies policies I cannot write the exact code . This was a typing mistake which I made while writing the question. Thanks again for your reply.

    – xpioneer
    Nov 19 '18 at 7:46











  • Yes I found in case of two scenarios exceptions are thrown . One in the case of camel enpoint not set and we are calling the endpoint. Second in case if for some reason MQ server goes down just before sending the message to endpoint.

    – xpioneer
    Nov 19 '18 at 17:27










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53321547%2fqueue-is-unavailable-but-no-exception-is-thrown-in-the-processor-of-a-camel%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Have you tried checking the exchange object after the process call in your try block to see if it's got an exception in it.



jmsProducer.process(exchange);
if (exchange.getException() != null)
exchange.getException().printStackTrace();;



I think you'll only get an exception thrown if it's something wrong with your jmsProducer (e.g. no camelContext).



... deleted bit about Exchange/Exception typo in original example ...






share|improve this answer

























  • thanks @pcoates for pointing it out. Actually this is not the exact code I had written. Due to my companies policies I cannot write the exact code . This was a typing mistake which I made while writing the question. Thanks again for your reply.

    – xpioneer
    Nov 19 '18 at 7:46











  • Yes I found in case of two scenarios exceptions are thrown . One in the case of camel enpoint not set and we are calling the endpoint. Second in case if for some reason MQ server goes down just before sending the message to endpoint.

    – xpioneer
    Nov 19 '18 at 17:27















0














Have you tried checking the exchange object after the process call in your try block to see if it's got an exception in it.



jmsProducer.process(exchange);
if (exchange.getException() != null)
exchange.getException().printStackTrace();;



I think you'll only get an exception thrown if it's something wrong with your jmsProducer (e.g. no camelContext).



... deleted bit about Exchange/Exception typo in original example ...






share|improve this answer

























  • thanks @pcoates for pointing it out. Actually this is not the exact code I had written. Due to my companies policies I cannot write the exact code . This was a typing mistake which I made while writing the question. Thanks again for your reply.

    – xpioneer
    Nov 19 '18 at 7:46











  • Yes I found in case of two scenarios exceptions are thrown . One in the case of camel enpoint not set and we are calling the endpoint. Second in case if for some reason MQ server goes down just before sending the message to endpoint.

    – xpioneer
    Nov 19 '18 at 17:27













0












0








0







Have you tried checking the exchange object after the process call in your try block to see if it's got an exception in it.



jmsProducer.process(exchange);
if (exchange.getException() != null)
exchange.getException().printStackTrace();;



I think you'll only get an exception thrown if it's something wrong with your jmsProducer (e.g. no camelContext).



... deleted bit about Exchange/Exception typo in original example ...






share|improve this answer















Have you tried checking the exchange object after the process call in your try block to see if it's got an exception in it.



jmsProducer.process(exchange);
if (exchange.getException() != null)
exchange.getException().printStackTrace();;



I think you'll only get an exception thrown if it's something wrong with your jmsProducer (e.g. no camelContext).



... deleted bit about Exchange/Exception typo in original example ...







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 19 '18 at 14:53

























answered Nov 18 '18 at 20:28









pcoatespcoates

1,025129




1,025129












  • thanks @pcoates for pointing it out. Actually this is not the exact code I had written. Due to my companies policies I cannot write the exact code . This was a typing mistake which I made while writing the question. Thanks again for your reply.

    – xpioneer
    Nov 19 '18 at 7:46











  • Yes I found in case of two scenarios exceptions are thrown . One in the case of camel enpoint not set and we are calling the endpoint. Second in case if for some reason MQ server goes down just before sending the message to endpoint.

    – xpioneer
    Nov 19 '18 at 17:27

















  • thanks @pcoates for pointing it out. Actually this is not the exact code I had written. Due to my companies policies I cannot write the exact code . This was a typing mistake which I made while writing the question. Thanks again for your reply.

    – xpioneer
    Nov 19 '18 at 7:46











  • Yes I found in case of two scenarios exceptions are thrown . One in the case of camel enpoint not set and we are calling the endpoint. Second in case if for some reason MQ server goes down just before sending the message to endpoint.

    – xpioneer
    Nov 19 '18 at 17:27
















thanks @pcoates for pointing it out. Actually this is not the exact code I had written. Due to my companies policies I cannot write the exact code . This was a typing mistake which I made while writing the question. Thanks again for your reply.

– xpioneer
Nov 19 '18 at 7:46





thanks @pcoates for pointing it out. Actually this is not the exact code I had written. Due to my companies policies I cannot write the exact code . This was a typing mistake which I made while writing the question. Thanks again for your reply.

– xpioneer
Nov 19 '18 at 7:46













Yes I found in case of two scenarios exceptions are thrown . One in the case of camel enpoint not set and we are calling the endpoint. Second in case if for some reason MQ server goes down just before sending the message to endpoint.

– xpioneer
Nov 19 '18 at 17:27





Yes I found in case of two scenarios exceptions are thrown . One in the case of camel enpoint not set and we are calling the endpoint. Second in case if for some reason MQ server goes down just before sending the message to endpoint.

– xpioneer
Nov 19 '18 at 17:27



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53321547%2fqueue-is-unavailable-but-no-exception-is-thrown-in-the-processor-of-a-camel%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

Evgeni Malkin