[rabbitmq-discuss] SharedQueue closed error

Michael Klishin mklishin at gopivotal.com
Wed Apr 2 21:50:42 BST 2014

On 3 April 2014 at 00:40:40, anate (ambatinr at hotmail.com) wrote:
> > I declared a queue with persistent message using PHP and trying  
> to consume
> the message in C#. I received 'SharedQueue closed error' at this  
> line.

What is in RabbitMQ log (when you see the exception)?

> channel.BasicAck(ea.DeliveryTag, false);
> I am assuming the persistent message shouldn't delete from queue  
> but after
> Dequeue() message getting deleted.

Your understanding is not correct. Persistent messages survive RabbitMQ
restart. They are deleted from the queue when they are acknowledged.

Since you use channel.BasicConsume("hello-queue", true, consumer),
messages are considered to be acknowledged as soon as RabbitMQ sends
them out to consumers. There is no need to ack them (and acking them
will result in a protocol exception).

QueueingConsumer will accumulate deliveries locally in a shared queue.
My guess is that QueueingConsumer shuts the shared internal queue down
when a protocol exception occurs.

Judging from your code you don’t need to use a QueueingConsumer. Simply
subclass DefaultConsumer and override HandleDelivery.


Software Engineer, Pivotal/RabbitMQ

More information about the rabbitmq-discuss mailing list