I'm trying to implement a dlx queue in RabbitMQ. The scenario is quite easy I have 2 queues: 1) alive 2) dead (x-dead-letter-exchange: "immediate", x-message-ttl: 5000)
and an exchange "immediate" that is bound to 1) alive
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 the messages are dropped after the ttl expires and they dont get published on the exchange, so my alive queue is always empty.
I also tried to create the queues by hand in the management console and I get the same behaviour.
I tested it with Ubuntu/rabbitmq 3.0.0 and with Mac OS X and rabbitmq 2.8.7
Am I missing something?
When messages 'disappear' in RabbitMQ the problem is usually down to the bindings. So, to get your example working I did the following:
Created 2 queues, alive, dead (with the TTL and DLX)
Created an exchange called immediate of type DIRECT
Created a binding between the exchange "immediate" and the queue "alive" with a routing key "dead" - the reason for this is because, the routing key for messages into the dead queue (if using the default exchange is 'dead' this needs to match in the binding on the dead letter exchange).
The important part here is in the binding between the immediate exchange and the alive queue.
To test I published a message into the dead queue, I can see it appear in the dead queue briefly then appear in the alive queue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With