[rabbitmq-discuss] Why does Channel.queueDeclarePassive close the channel?

Yuesong Wang yuesong.c at gmail.com
Fri Feb 18 17:03:01 GMT 2011


Thanks. It helps to know what's expensive and what's not

The AMQP reference says about active declare:

If [passive] not set and the queue exists, the server MUST check that the existing queue has the same values for durable, exclusive, auto-delete, and arguments fields. The server MUST respond with Declare-Ok if the requested queue matches these fields, and MUST raise a channel exception if not.

For that reason, I want to leave the active declare to producers so the consumers don't have to care whether the queue is durable, auto-delete and what not. A little bit less coupling. But I got what you said.

Now on the producer side, a dumb but easy way to make sure the queue gets recreated if missing is to always declare the queue and binding before every publish. It works but I'd imagine it is very inefficient, yeah? The consumer code is a bit more complicated with the use of QueueConsumer and Channel.basicConsumer. For a running consumer to use a recreated queue, do I have to instantiate a new QueueConsumer, and call Channel.basicConsumer again? I'm new to RabbitMQ and there seems to be a lot of options to go about this. Any pointers are much appreciated.


On Feb 18, 2011, at 11:40 AM, Simon MacMullen wrote:

> Hi Yuesong.
> On 18/02/11 16:31, Yuesong Wang wrote:
>> What I really want to do is for both the producers and consumers to
>> automatically recover from a queue gone missing
> In that case both producers and consumers should declare the queue actively. Declaring a queue that already exists is not a problem, and the costs associated with doing so are low.
> Cheers, Simon
> -- 
> Simon MacMullen
> Staff Engineer, RabbitMQ
> SpringSource, a division of VMware
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110218/7942156d/attachment.htm>

More information about the rabbitmq-discuss mailing list