[rabbitmq-discuss] Reordering on requeue

Emile Joubert emile at rabbitmq.com
Mon Jul 4 11:41:02 BST 2011


Hi Jiri,

On 04/07/11 07:35, Jiri Krutil wrote:
>>> Will a requeued message be pushed back onto the queue tail or will it
>>> stay at the head?
>>
>> It will go to the tail. We are considering changing that behaviour for 
>> channel/connection closure and basic.recover{requeue=true}, but 
>> basic.reject/nack will likely stay as they are.
> 
> I asked because I was wondering if there is a way in rabbit how to
> emulate read-only queue browsing, as supported by Qpid. (I think they
> support it because they are so JMS-like.)

If you are attempting to scan all the messages in a queue without
removing them then this is not currently possible. The closest
alternative is to fetch and recover messages with the requeue flag
turned on, but this is not guaranteed to preserve message order. We are
currently working on preserving message order of queues with a single
consumer issuing basic.recover{requeue=true}.

> I guess currently this can only be done in rabbit using the management
> plugin? And should not be used for regular processing, but only for
> ad-hoc monitoring?

The management plugin does not have privileged access to queue messages.
Viewing a message with the requeue option has the same effect as using
basic.get and basic.recover with any client library that supports those
operations.

> I understand queue browsing is not in AMQP standard, but a Qpid
> extension, correct?

javax.jms.QueueBrowser appears in JMS, so you should see an
implementations of that interface in many providers.

> What about the message ordering on reject - I assume the specs does not
> say where should a requeued message appear on the queue?

Messages that are returned to the queue due to
basic.recover{requeue=true} as well as basis.reject go to the tail of
the queue.


-Emile


More information about the rabbitmq-discuss mailing list