Dead letter exchange RabbitMQ

I am trying to implement a dlx queue in RabbitMQ. The scenario is quite simple I have 2 queues: 1) live 2) dead (x-dead-letter-exchange: "immediate", x-message-ttl: 5000)

and the exchange "immediate" associated with 1) live

I tried to run this example: http://blog.james-carr.org/2012/03/30/rabbitmq-sending-a-message-to-be-consumed-later/ but it seems that messages are discarded after expiration ttl, and they are not published on the exchange, so my live queue is always empty.

I also tried to create the queues manually in the management console, and I get the same behavior.

I tested it with Ubuntu / rabbitmq 3.0.0 and with Mac OS X and rabbitmq 2.8.7

Did I miss something?

+7
source share
1 answer

When messages "disappear" in RabbitMQ, the problem usually comes down to bindings. So for your example to work, I did the following:

  • 2 queues created, living, dead (with TTL and DLX)

  • Created an exchange called the direct type DIRECT

  • Created a binding between the "immediate" exchange and the "live" queue with the dead key for the routing key - the reason for this is that the routing key for messages in the dead queue (if the default value is "dead" exchange, this should match the binding to dead letter exchange).

The important part here is the link between the immediate exchange and the busy queue.

To verify that I posted a message in a dead queue, I see that it appears in a dead queue and then appears in a queue.

+8
source

All Articles