I have a requirement to load messages from two queues and i am using ActiveMQ, I have to implement the Retry mechanism in case of any error or network or application server failure and load back into the same Queue. Also, I want to load any poison messages to DLQ.
Please let me know if I can acheive these through Spring JMS. Also, please advise some good examples to accomplish this task. I checked Spring JMS documentation and have not much details in that.
I tried doing the same. But my poison messages are not getting into DLQ. Here is my configuration xml and Listener/Consumer. Can you please review and advise if any error or mistakes in my code.
Also kindly provide me the answers for this questions
A) I am using activemq 5.5 and in the redelivery policy is not accepting the queue property (see **** comment in XML file). So I tried creating DLQ manually in admin server and re-run the Listener, the poison messages are not getting queued there. Please advise?
B) Should I need to create the DLQ explicity from the code or does activemq creates after error message is retried after some time?
I got the fix. I was catching the exception in catch block which I understood should not be. If I throw the exception from Catch Block, the message is going to DLQ after respective retries.
Please advise how could the below requirements be accomplished through ActiveMQ and Spring JMS.
A) I want to push the messages into DLQ only when respective exception occurs. Currently as per my understanding, any exceptions thrown from Message Listeners are moved to DLQ after specified retry parameters.
B) Could I control the like No-Retry for custom exceptions. For example, if there is an Instance of MyException class thrown, I should not retry those messages such that it should not even go to DLQ.
You guys haven't done this much, have ya? I suggest you study this tiny ad: