[rabbitmq-discuss] Can a queue auto_delete if it doesn't have a consumer when created?

Matthias Radestock matthias at rabbitmq.com
Sat Jan 8 08:16:03 GMT 2011


Bill,

Bill Moseley wrote:
> So, there's no consumers on the queue, and it's flagged auto_delete.  An 
> I misunderstanding how auto_delete works on queues?
> 
> Is the problem that when I created the "amq.gen-tYjOPWR6ZV0crLn5ga5KZg== 
> " queue that there were no consumers so the queue will never get deleted?

 From the xml spec for auto-delete:
"If set, the queue is deleted when all consumers have finished using it. 
  The last consumer can be cancelled either explicitly or because its 
channel is closed. If there was no consumer ever on the queue, it won't 
be deleted. Applications can explicitly delete auto-delete queues using 
the Delete method as normal."

> Is using "x-expires" the solution?

That's one option. Or instead of consuming the message with basic.get 
use basic.consume. Or, as noted above, delete the queue explicitly. With 
x-expires the queue will get deleted eventually even when the reply is 
never read, which may or may not be what you want to happen.

Regards,

Matthias.


More information about the rabbitmq-discuss mailing list