Author |
Message
|
krama5717 |
Posted: Thu Sep 17, 2015 1:43 pm Post subject: Backout queues in MQ JMS using Spring. |
|
|
Newbie
Joined: 17 Sep 2015 Posts: 4
|
I am struggling with code that uses CLIENT_ACKNOWLEDGE mode in a Spring/JMS enabled piece of code. What we want to do is to throw a poisoned message to the back out queue. I cannot find any examples anywhere to achieve this in CLIENT_ACKNOWLEDGE mode. I do know that this is relatively easy to do in TRANSACTION mode. Please help. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Sep 17, 2015 5:35 pm Post subject: Re: Backout queues in MQ JMS using Spring. |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
krama5717 wrote: |
I am struggling with code that uses CLIENT_ACKNOWLEDGE mode in a Spring/JMS enabled piece of code. What we want to do is to throw a poisoned message to the back out queue. I cannot find any examples anywhere to achieve this in CLIENT_ACKNOWLEDGE mode. I do know that this is relatively easy to do in TRANSACTION mode. Please help. |
AFAIK you can only have this happen in client_acknowledge mode, if MQ itself determines that the message is bad an cannot be delivered / read.
Anything else gets aknowledged when the client in fact does acknowledge...
Keep it transactional!  _________________ MQ & Broker admin |
|
Back to top |
|
 |
krama5717 |
Posted: Fri Sep 18, 2015 4:41 am Post subject: |
|
|
Newbie
Joined: 17 Sep 2015 Posts: 4
|
Thank you for the wisdom, Oh Grand Poobah.. before we go down the path of modifying the code to be TRANSACTIONAL, I need guidance on just one thing more. I am thinking of short term and long term solutions here.
In this environment, under Spring , JMS, MQ ....
1. What happens to a message when the onMessage method throws an exception ? (in CLIENT_ACKNOWLEDGE )... so the message is in flight, and something happens, and we throw an exception.... what is the disposition of the message ? Will it get dropped or re-queued ? Will it get acknowledged along with a subsequent acknowledge and therefore de-queued ?
2. How do you recommend that we take care of this situation, since the backout queue mechanisms are not available to us ? If we want to drop it into a queue, do we create another queue and do a queueSender() so to speak ?
There is so much google out there, and it is an ocean to wade through. Some expert guidance is really appreciated.  |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Sep 18, 2015 5:46 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
If an application throws an exception while processing a transactional message, the trasaction is rolled back.
During an MQ Transaction, the message is not actually removed from the queue. It's merely marked in a transaction and so isn't visible to other readers.
Thus, when the transaction is rolled back, the message reappears on the queue.
I believe in this case the backout count is incremented.
Normal MQ applications have to handle backout themselves. I don't know what Spring does. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
krama5717 |
Posted: Fri Sep 18, 2015 9:57 am Post subject: |
|
|
Newbie
Joined: 17 Sep 2015 Posts: 4
|
Yes, in transaction mode, it's perfectly clear.... either rollback or exception will request the message. It is my understanding that client acknowledge melody is non-transactional. So where do I go look for an answer ? |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Sep 18, 2015 10:05 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
IF the onMessage is part of a transaction, then when it throws an exception, the queue transaction will get rolled back.
This is not the same as backed out.
I forget if JMS handles backout for you. Regarless of what you're using to call JMS, the behavior for MQ JMS will be the same. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
|