-
Oct 3rd, 2011, 08:05 AM
#1
Sending requeue=false on failure
Currently, when there is an exception in a listener, the container's BlockingQueueConsumer does this:
channel.basicReject(deliveryTag, true);
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
#2
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
#3
Where do I catch the exception? The listener's onMessage won't see the queue-related exceptions.
-
Oct 12th, 2011, 12:03 PM
#4
What is "queue-related"? Can you describe an example failure scenario in a bit more detail?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules