[rabbitmq-discuss] Multiple subscription in the same thread

Ben Hood 0x6e6562 at gmail.com
Fri Feb 13 09:58:34 GMT 2009


Roger,

On Thu, Feb 12, 2009 at 6:04 PM, Wilson, Roger <roger.wilson at lehman.com> wrote:
> A question to the wise.  Is it legal, advisable/risky or simply deviant
> to subscribe to multiple queues from the same Consumer?

>From a protocol perspective I would say that it shouldn't make a
difference. This is because the broker has knowledge of the existence
of any consumer, just the fact that it it can send deliveries to a
client with a particular tag so that the client can dispatch messages
accordingly.

> I have a java client implementing the Consumer interface which calls
> Channel.basicConsume on two queues, stays subscribed for about 10s and
> then calls basicCancel.
>
> This tends to work for a few calls and then when calling
> Channel.basicConsume for the second queue it hangs.  Always the second
> queue.
>
> Is there something fundamentally wrong with the same consumer consuming
> two queues?

Not really. The client will maintain two keys for the same consumer
reference, that's all. Maybe you can post some code that can reproduce
this behaviour.

Ben




More information about the rabbitmq-discuss mailing list