Announcement Announcement Module
No announcement yet.
Dead Lettering Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dead Lettering

    RabbitMQ 2.8 supports dead lettering, see

    I use a StatefulRetryOperationsInterceptorFactoryBean and after x tries I want the message to go to the dead letter exchange. As far as I understand the message needs to be rejected after the retries. How can I do that?

    Are there any plans for extended dead lettering support in Spring AMQP?


  • #2
    If you provide a MessageRecoverer to the factory bean (called when retries are exhausted), and it throws an exception, the listener will send a basic.reject which should trigger the DLQ behavior, according the the RabbitMQ docs.

    DLQ configuration is controlled by queue arguments; spring-amqp supports this in a number of ways, such as...

    <rabbit:queue id="queue1">
    		<entry key="x-dead-letter-exchange" value="" />
    However, there have been some rabbit API changes and the 1.0.0.RELEASE doesn't support 2.8.0.

    I do have a branch on my clone that supports the newer API and I have tested it against 2.8.0 if you want to experiment with DLQs.

    We expect to release this in 1.0.1 shortly.


    • #3
      Sorry - my mistake, I see we have to set requeue to false on the reject to invoke DLQ behavior.

      Please open an improvement JIRA here...



      • #4
        I have pushed a prototype implementation here...

        As noted in the commit comment, there is currently a problem with dead-lettering messages sent to durable queues, but I have tested without issue with non-durable queues.

        The Rabbit guys know about the problem and it will be fixed in an upcoming release.


        • #5
          Thanks Gary! Any idea when the 1.0.1 release will be out?


          • #6
            The release (now called 1.1.0.RELEASE) will be announced imminently, once we get the documentation up on the SpringSource web site; the jars should be in maven central already.

            It uses spring-retry-1.0.1.RELEASE, which fixes a problem with the exponential back-off policy when you use the retry interceptor.

            In order to send the message to the DLE/DLQ, the MessageRecoverer must throw an AmqpRejectAndDontRequeueException. This signals the listener container to reject the message, with requeue set to false, causing the message to be sent to the Dead Letter Exchange.

            Update your POMs, and give it a shot!

            For users not using retry, where you want to immediately send to the DLE/DLQ if one attempt fails, you can simply set requeue-rejected to false (defaults to true) on the container.