Dead letter exchange cycles

222 views
Skip to first unread message

michal.sz...@codilime.com

unread,
May 12, 2015, 10:32:17 AM5/12/15
to rabbitm...@googlegroups.com
Hi!

I want to requeue some messages at the end of the queue while using the newest rabbitmq. I know, that before version 2.7 this was the default behaviour. I am trying to achieve this effect by using two queues with dead letter exchange properly configured, of which one has also TTL set. The idea is to nack the message from the first queue with requeue=False. This message then gets into the second queue and after the TTL time expires it should get back to the first queue, but instead it is removed. In this stack response: http://stackoverflow.com/questions/28631380/dead-lettering-dead-lettered-messages-in-rabbitmq there is a quote from the DLX documentation that suggest that only when a message passes through the whole dead letter cycle due to TTL will be it removed. In my case after i nack the message from the first queue, and it gets to the second queue I notice that after TTL expires the message is removed instead of being delivered to the first queue. Is there a solution to my problem without setting up an additional consumer?

Jean-Sébastien Pédron

unread,
May 13, 2015, 7:12:39 AM5/13/15
to rabbitm...@googlegroups.com
On 12.05.2015 16:32, michal.sz...@codilime.com wrote:
> Hi!

Hi!

> I want to requeue some messages at the end of the queue while using the
> newest rabbitmq. I know, that before version 2.7 this was the default
> behaviour. I am trying to achieve this effect by using two queues with
> dead letter exchange properly configured, of which one has also TTL set.
> The idea is to nack the message from the first queue with requeue=False.
> This message then gets into the second queue and after the TTL time
> expires it should get back to the first queue, but instead it is
> removed.

Do you see a message in the log file which looks like the following?

"Message dropped. Dead-letter queues cycle detected: ..."

--
Jean-Sébastien Pédron
Pivotal / RabbitMQ

michal.sz...@codilime.com

unread,
May 13, 2015, 9:22:54 AM5/13/15
to rabbitm...@googlegroups.com, jean-se...@rabbitmq.com
Yes, the cycle detection kicks in. From what I found in StackOverflow in case of cycle detection
the message is deleted. Is this related to the TTL  setup?

Jean-Sébastien Pédron

unread,
May 13, 2015, 12:23:23 PM5/13/15
to rabbitm...@googlegroups.com
In fact, only fully automatic cycles cause the message to be dropped. If
during a cycle, one reason was "rejected" (ie. a NACK'd message), the
message should be kept.

What version of RabbitMQ are you using?

michal.sz...@codilime.com

unread,
May 14, 2015, 8:30:55 AM5/14/15
to rabbitm...@googlegroups.com, jean-se...@rabbitmq.com
I'm using version 3.4.1. The flow of messages was supposed to look like this: recieve message from the main queue, if you can handle it send ack, else send nack with requeue=False. This should cause the message to be dead lettered and be requeued to the other queue, that has both TTl and DLX set. After the right amount of time passes I expected the message to be requeued in the main queue, but instead it vanished. It seems that the problem was caused by me not setting the dead letter exchange routing key property on the queues. This caused the message to be routed to the exchange with the first routing key, that was not changed when exiting the second queue.
Reply all
Reply to author
Forward
0 new messages