[rabbitmq-discuss] Routing through multiple dead-letter exchanges

Tim Watson tim at rabbitmq.com
Tue Aug 20 16:37:34 BST 2013


Hi,

On 20 Aug 2013, at 16:12, reaperman123456789 at gmail.com wrote:
> Everything works as expected up to this point. However, when the message TTL of "deferredqueue" is up, I expected the message to reappear again in "livequeue" via the dead-letter exchange of "deferredqueue", but the message is dropped instead.
> If, however, I ack the message in "livequeue" and publish it to "deferredqueue" using basic_publish, instead of rejecting it, the message does reappear in "livequeue"  after the TTL is over, as expected.
> 
> So my question is, is this the normal (intended) behavior, or am I doing something wrong? 

This is indeed normal/expected behaviour. Dead letter cycles that occur entirely due to expiry are removed, so if the TTL expiry initially occurred in 'livequeue' then when the message later expires in 'deferredqueue' it won't be delivered to 'livequeue' again.

> If this is the normal behavior, is there a way to change it by some exchange/queue/message property, so it will work as I initially planned?

That one I'm not so sure about. One way to handle this would be to use the shovel plugin to handle republishing messages once they expire in the 'deferredqueue', rather than attempting to use TTL + DLX in a cyclic configuration. Set up a third exchange + queue: 'repub-ex' and 'repub-queue'. Configure the DLX for the 'deferredqueue' to publish to the 'repub-ex'  exchange. Enable the shovel plugin and set up the 'repub-queue' as the source and the 'live' exchange as the destination. Once messages in the 'deferredqueue' expire, they will be delivered to the 'repub-ex' exchange and routed to the 'repub-queue', at which point the shovel will dequeue and ACK them, then publish them to the 'live' exchange once again. You can configure the shovel plugin to add a custom header to these messages to indicate that they're being republished, if that's something your client application needs to now. 

Cheers,
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130820/9926c0be/attachment.htm>


More information about the rabbitmq-discuss mailing list