[rabbitmq-discuss] Dead letter exchange behavior / best practice

Ludovic Fleury ludo.fleury at gmail.com
Sun Oct 28 07:53:15 GMT 2012

I tried another setup which seems to don't work either...

Here's my second setup:
-"my-exchange" bound to "my-queue"
-"my-ttl-exchange" bound to "my-ttl-queue" with a "x-message-ttl set to 

- "my-queue" has a DLX set on "my-ttl-exchange'.
- "my-ttl-queue" has a DLX set on "my-exchange".

I have only one worker which consume my-queue.

So the scenario should be simple, a message is published into 
"my-exchange", which place the message into "my-queue".
The worker consume the message in "my-queue", 
if the worker reject the message, it should be placed into "my-ttl-queue" 
with a ttl of 5 seconds.
Since there is no worker consuming "my-ttl-queue", the message ttl will 
expire and ... the message should be re-placed into "my-queue".

Basically, everythig work except the last part: once in "my-ttl-queue", the 
message does'nt seems to be placed in the correct DLX nor in the original 

So I assume cyclic DLX are not allowed ? 

Le dimanche 28 octobre 2012 07:41:54 UTC+1, Ludovic Fleury a écrit :
> Hey,
> I'm new to RabbitMQ and I try to use the dead letter exchange feature.
> Yet, I don't know if I make a misstake or if I misunderstand the 
> documentation about it:
> As far as I read in the doc: 
> The dead-lettering process adds an array to the header of each 
>> dead-lettered message named x-death. 
> This array contains an entry for each time the message was dead-lettered. 
>> Each such entry is a table that consists of several fields
> So basically, I have 2 queues and 2 exchanges:
> -"my-exchange" bound to "my-queue"
> -"my-dead-exchange" bound to "my-dead-queue"
> I have set a DLX on "my-queue" to "my-dead-exchange" and I have set 
> another DLX on "my-dead-queue" to ... "my-dead-exchange".
> The last DLX is a cylic DLX. I hope this is okay ?
> When I first reject a message on "my queue", everything is okay: I have 
> the message handled by "my-dead-exchange" and placed to "my-dead-queue".
> But then, when I reject again the message... The message is not handled by 
> "my-dead-exchange" and nor replaced into the "my-dead-queue".
> With the documentation, I understand that: every time a message is 
> rejecteted, I would be able to "count" the number of rejection by counting 
> on the "x-death" header.
> So instead of rejecting with a requeue, I would like to take advantage of 
> this behavior by rejecting into a "cylic DLX" (to count the total of 
> rejection for a message).
> Is my implementation incorrect ? How can I handle this need in RabbitMQ ?
> Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20121028/624cfce8/attachment.htm>

More information about the rabbitmq-discuss mailing list