« Return to Thread: Spring MessageListenerAdapter and invalid ReplyTo destination

Re: Spring MessageListenerAdapter and invalid ReplyTo destination

by IIT Software :: Rate this Message:

Reply to Author | View in Thread

There are legitimate reasons for a message to be redelivered other than from a failure to send a response.  
I don't mind any other case than a rollback of a transaction. The JMSRedelivered flag will be set if the message has already been passed in a former transaction or non-transacted delivery to the application via onMessage/receive. If you don't do rollbacks yourself, the JMSRedelivered flag should work fine.

Actually you will receive an InvalidDestinationException (extends JMSException) if you try to send to a temp queue which has been deleted in the meantime. This exception will be thrown if you try to create a producer on it. However, deletion of such a temp destination is asynchronously and can happen any time, e.g. after the producer has been created and while it writes to the queue and before commit. In that case it is possible that you will get a simple JMSException.

I would catch InvalidDestinationException and would check the JMSRedelivered flag.

 « Return to Thread: Spring MessageListenerAdapter and invalid ReplyTo destination