Oct 3rd, 2011, 08:05 AM
Sending requeue=false on failure
Currently, when there is an exception in a listener, the container's BlockingQueueConsumer does this:
However, we want to send requeue=false in these cases. An additional requirement is to send failed messages to a separate queue ("failed.messages").
Currently I implemented that by copy-pasting a couple of spring-rabbit/amqp classes and changed the desired pieces of code, but that's ugly. Any better approach?
Oct 7th, 2011, 09:20 AM
basicReject() is only called if you use acknowledgeMode=AUTO, so maybe you just need to use acknowledgeMode=NONE? What would be the benefit of AUTO if you didn't ask the broker to redeliver - maybe if it is a common use case we can expose a flag or something?
For the failed message queue, you could put the logic in your listener - catch exceptions and decide for each one whether to send the message to the failed queue - or you could do that declaratively with a retry interceptor in the advice chain of the listener container. There should be some samples of that in the integration tests. This is something we have considered making a first class feature of the framework, so if you like the idea a lot raise a JIRA and/or contribute some code.
Oct 12th, 2011, 07:58 AM
Where do I catch the exception? The listener's onMessage won't see the queue-related exceptions.
Oct 12th, 2011, 12:03 PM
What is "queue-related"? Can you describe an example failure scenario in a bit more detail?