[rabbitmq-discuss] Push to back of Queue on NAck

Tom Anderson tom.anderson at timgroup.com
Fri Jul 26 16:49:22 BST 2013

On 26/07/13 14:18, Matthias Radestock wrote:
> On 26/07/13 13:25, Will Hughes wrote:
>> Another option I was thinking of to enforce more a delay was to see if I
>> could chain together two queues using dead-letter-exchange settings:
>> Queue A, no TTL, DLX=Exchange B (with Queue B bound to it).
>> Queue B, ttl of (x) seconds, DLX= Exchange A (with Queue A bound to it).
>> When we NAck the mesage from Queue A, we set requeue=false.
>> I've not seen much discussion so far on whether it's sane to hook up two
>> queues/exchanges in a loop like this.
> Yep, that makes perfect sense and should work well.

Implemented exactly as described there, it yields an infinite loop for 
unprocessable messages. You might therefore also want to keep a count of 
the number of processing attempts in a header on the message, and more 
thoroughly reject messages which reach some maximum number of attempts. 
I think you could do the final rejection by setting a routing key on the 
message when you reject it for the last time, and having exchange B be a 
direct exchange which routes to either queue B or some final deadletter 

If you want exponential backoff in the retries, then life gets more 
complicated (multiple timeout queues, selected between by a routing key 
set by the consumer of A?). We are currently pussyfooting around this 
issue at my company. I will report back here if we ever implement a good 



Tom Anderson | Developer | +44 20 7826 4312 | timgroup.com 

STATEMENT OF CONFIDENTIALITY: The information contained in this 
electronic message and any attachments to this message are intended for 
the exclusive use of the addressee(s) and may contain confidential or 
privileged information. If you are not the intended recipient, please 
notify Tom Anderson at TIM Group at tom.anderson at timgroup.com and 
destroy all copies of this message and any attachments.

TIM Group is the trading name for YouDevise Limited. YouDevise Limited 
is registered in England, No. 3331176. Registered office: 3 Copthall 
Avenue, London, EC2R 7BH.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130726/d8ddf1c3/attachment.htm>

More information about the rabbitmq-discuss mailing list