Results 1 to 4 of 4

Thread: Sending requeue=false on failure

  1. #1
    Join Date
    Nov 2006
    Posts
    20

    Default 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?

  2. #2
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    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.

  3. #3
    Join Date
    Nov 2006
    Posts
    20

    Default

    Where do I catch the exception? The listener's onMessage won't see the queue-related exceptions.

  4. #4
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    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
  •