Results 1 to 6 of 6

Thread: Dead Lettering

  1. #1

    Default Dead Lettering

    RabbitMQ 2.8 supports dead lettering, see http://www.rabbitmq.com/extensions.h...tter-exchanges.

    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?

    Thanks,
    Paul

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,036

    Default

    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...

    Code:
    <rabbit:queue id="queue1">
    	<rabbit:queue-arguments>
    		<entry key="x-dead-letter-exchange" value="my.dlq.exchange" />
    	</rabbit:queue-arguments>
    </rabbit:queue>
    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 https://github.com/garyrussell/sprin.../tree/AMQP-195 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.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,036

    Default

    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...

    https://jira.springsource.org/browse/AMQP

    Thanks
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,036

    Default

    I have pushed a prototype implementation here... https://github.com/garyrussell/spring-amqp/tree/dlq

    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.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  5. #5

    Default

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

  6. #6
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,036

    Default

    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.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •