[rabbitmq-discuss] dead-letter-exchange behaviour

Matthias Radestock matthias at rabbitmq.com
Thu Aug 2 00:03:11 BST 2012


On 01/08/12 17:00, cogitate wrote:
> i am trying to get dead-letter-exchange work..
>   steps below:
> [0] s2.direct is an exchange that declares a dead-letter-exchange(DLE)
> called s2.dlx ( rabbitmq )
> [1] setup DLE consumer -  declares a DLQ (pyDlxQueue) binds to DLE(s2.dlx)
> [2] setup a consumer listening to queue (EchoPayMe) binds to
> s2.direct(exchange)
>      queue EchoPayMe setup with arguments x-message-ttl=10 and DLE=s2.dlx
>      the consumer also sleeps for 100 seconds ( to simulate
> long-running/hanging service)
>      the idea is a producer puts 10 messages in it's queue will only have
> message 1 served,
>      the rest of the messages should go to DLE(s2.dlx) when the DLE consumer
> replies.
> [3] the producer - publish messages to s2.direct exchange w/ rk="EchoPayMe"
> the problem is no messages are received by the DLQ or get routed to the DLE
> consumer.
> the code for the DLE consumer, App consumer and App Producer in python/pika
> below.


> i am sure there's a fundamental error in what i am doing


> --  Consumer ---
> [...]
> #channel.basic_qos(prefetch_count=1)

Try uncommenting that. Without a prefetch set, the broker will happily 
send all messages straight to the consumer as soon as they enter the 
queue, as explained in the "Fair dispatch" section of 
http://www.rabbitmq.com/tutorials/tutorial-two-python.html. If the 
client is busy then he messages will be buffered in the network / the 
client, but as far as the broker is concerned they have been delivered 
straight away and so won't be expired & dead-lettered.



More information about the rabbitmq-discuss mailing list