[rabbitmq-discuss] durable exclusive queues

Gordon Sim gsim at redhat.com
Mon Sep 8 07:18:28 BST 2008

Matthias Radestock wrote:
> Aman Gupta wrote:
>> Is it possible to simulate this exclusive behavior?  I can do a passive
>> declare and look at the consumer count in the declare-ok, but that will 
>> introduce race conditions without a central lock.
> It is not clear from the above what exactly you are trying to simulate. 
> Durable exclusive queues? As I explained, that doesn't make sense.
>  From your description though it appears that perhaps you want queues 
> that are exclusive to one connection *at a time*, i.e. they can be 
> "acquired" by different connections over their lifetime. And such queues 
> could of course then sensibly be made durable.
> If so, then one way to implement that is to have a secondary queue that 
> holds a token. Connections that want to use the "shared exclusive queue" 
> subscribe to the token queue. When they receive the token they know they 
> have exclusive access. To relinquish access they publish the token back 
> to the token queue, where it can be consumed by another connection.

The 'exclusive' field on the 'basic.consume' method allows consumers to 
request exclusive access to a queue; if someone else is already 
accessing it they are informed through an error condition. This at least 
allows the application to detect and rely on the fact that only one 
client can consume at a time.

More information about the rabbitmq-discuss mailing list