[rabbitmq-discuss] BasicCancel and the QueueingBasicConsumer SharedQueue

Matthias Radestock matthias at rabbitmq.com
Wed Nov 7 10:17:03 GMT 2012


Mark,

On 06/11/12 17:44, Mark Ward wrote:
> I was under the impression I could have a BasicConsumer running and be able
> to subscribe/unsubscribe to queues while it was running.

I am guessing you mean creating a single instance of 
QueuingBasicConsumer, and then using that in multiple BasicConsume commands.

The problem, which I think is what you ran into, is that a cancellation 
of *any* of the consumers will close the underlying shared queue.

So instead I'd suggest creating multiple QueueingBasicConsumers. It is 
perfectly ok to have multiple consumers on the same channel.

> What I want to make sure happens is the connection's channel is not
> subscribed to the queue when the client deletes the temporary queue.
> BasicCancel works but I also need to make sure my loop processing the
> BasicConsumer SharedQueue is stopped to avoid the exception from dequeue().

The EndOfStreamException thrown by Dequeue() is the very signal-to-stop 
your loop should be watching out for.

Regards,

Matthias.



More information about the rabbitmq-discuss mailing list