[rabbitmq-discuss] Enforcing single connection to a queue

Matthias Radestock matthias at rabbitmq.com
Fri Apr 20 11:29:29 BST 2012

On 19/04/12 21:27, RoLo wrote:
> I'm working on a project where we need to enforce only a single client
> connection to a queue.  Worse, the queue has to persist when the connection
> closes, which rules out using the exclusive bit as the AMQP spec states that
> an exclusive queue will always be auto-deleted when the client terminates
> session.
> We've decided to use RabbitMQ.  After extensive searching, I haven't found
> anything on the RabbitMQ side to enforce this requirement.  If there is, I'd
> love to hear about it.

There is an 'exclusive' flag on basic.consume. See 
That works well for preventing clients from accidentally tripping over 
each other when consuming from a queue, but it wouldn't prevent 
malicious clients from, say, deleting or purging the queue, or fetching 
messages with basic.get. If that is a concern then secure queue names, 
as suggested by Simon, are the way to go.


More information about the rabbitmq-discuss mailing list