Moving a message to back of queue?

833 views
Skip to first unread message

Aracas

unread,
Mar 26, 2015, 5:32:45 AM3/26/15
to rabbitm...@googlegroups.com
Hi, I want to move a message to the back of the queue when the current consumer can't process it, I thought that doing a NACK with the requeue option set to true would do this but it appears to leave the message in its current position in the queue? The only way I have found at the moment is to ACK the message and republish it to the same queue but I am sure there must be a better way?

Jean-Sébastien Pédron

unread,
Mar 26, 2015, 5:36:53 AM3/26/15
to rabbitm...@googlegroups.com
Hi!

I think consuming it and republishing it is the only way to achieve
this. Issueing a NACK keeps the message at the head of the queue because
message ordering is an important aspect of AMQP. It behaves like your
consumer was terminated without acknowledgeing the message.

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

Aracas

unread,
Mar 26, 2015, 5:47:12 AM3/26/15
to rabbitm...@googlegroups.com, jean-se...@rabbitmq.com
Thanks for your reply, in that case does rabbit have any concept of scheduling messages to be published to a queue at a later time?

Michael Klishin

unread,
Mar 26, 2015, 6:24:54 AM3/26/15
to rabbitm...@googlegroups.com, Aracas, jean-se...@rabbitmq.com
 

On 26 March 2015 at 12:47:15, Aracas (huffe...@gmail.com) wrote:
> > in that case does rabbit have any concept of scheduling messages
> to be published to a queue at a later time?

Not that the moment, although you can abuse message TTL + dead lettering for that purpose. 
A new exchange type for that is likely to appear in a future release.
--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Simon MacMullen

unread,
Mar 26, 2015, 6:29:11 AM3/26/15
to Jean-Sébastien Pédron, rabbitm...@googlegroups.com
On 26/03/15 09:36, Jean-Sébastien Pédron wrote:
> I think consuming it and republishing it is the only way to achieve
> this.

Alternatively: set the queue up to dead-letter to itself, and reject
with requeue=false. That requires a bit less smarts in the consumer, but
assumes you're not using dead-lettering for anything else.

Cheers, Simon
Reply all
Reply to author
Forward
0 new messages