Mansur
Mansur

Reputation: 1829

Spring AMQP - return the message back to the beginning of the queue

I would like to know if there is any way to return message back to its original place in queue. For example, let's say we have this ordering:

A-B-C-D with A being the head and D being the tail. Normally, when we use nack or reject with requeue=true, it simply enqueues the message after the current tail. In this case, when A is requeued, the new ordering becomes B-C-D-A. However, I wonder if there's any way to enqueue to the beginning of the queue. So, if A is "sent back", it would be placed at the beginning of the queue, in its original place.

I search for a solution using Spring AMQP.

Upvotes: 0

Views: 1476

Answers (1)

Gary Russell
Gary Russell

Reputation: 174719

You need to set the prefetch (qos) to 1. Otherwise any prefetched messages will be delivered before the redelivery of A.

It will, however, impact performance.

Upvotes: 1

Related Questions