[rabbitmq-discuss] Policy for dead letter exchange routing back to queue

Nicholas A. Stuart nicholasastuart at gmail.com
Fri Nov 29 05:20:48 GMT 2013


I'm trying to mimic the retry policy of ActiveMQ, where I can requeue a message if it fails a certain criteria(reject with requeue), but I want to only requeue it 5 times. I know that using a DLX/DLQ and rejecting a message without requeue will create an x-death header that will provide a count for the number of times failed. 

To give you an example, we're consuming messages from a queue in order to send them to web services(old architecture, cannot change). There are times where the web service may be down, so if it is, we'd like to requeue the message, but if the message has been tried 5 times, we'd like to just put it into another queue for later. We like the reject ability as it guarantees that it fails or succeeds for us atomically, but RabbitMQ/AMQP doesn't provide any type of retry/requeue count, except with the x-death property which provides us some insight into the failure of the message. 

----- Original Message -----
From: "Simon MacMullen" <simon at rabbitmq.com>
To: "Discussions about RabbitMQ" <rabbitmq-discuss at lists.rabbitmq.com>
Cc: "Nicholas Stuart" <nicholasastuart at gmail.com>
Sent: Thursday, November 28, 2013 4:05:46 AM
Subject: Re: [rabbitmq-discuss] Policy for dead letter exchange routing back to queue

On 27/11/13 15:25, Nicholas Stuart wrote:
> I've successfully set up a dead letter exchange policy where
> the|dead-letter-exchange|is blank, which will return the message to the
> original queue. However this only happens if the message was published
> to the default exchange, or with a routing key of the queue name.
>
> If I set up a fanout or topic exchange, my message is dropped(rightfully
> so). Is there any way, in the RabbitMQ policy, that I can specify a
> routing key policy that will always point back to the queue the message
> was consumed off of?

No, there isn't. Unless you want to create one policy per queue in which 
case you can set dead-letter-routing-key of course.

Why do you want to dead-letter back to the original queue?

Cheers, Simon

-- 
Simon MacMullen
RabbitMQ, Pivotal


More information about the rabbitmq-discuss mailing list