[rabbitmq-discuss] Creating Multiple Consumers bounded to same channel in different threads

Simon MacMullen simon at rabbitmq.com
Thu Feb 10 12:31:11 GMT 2011


On 10/02/11 12:23, Prashant wrote:
> I already did that :) ( that was what I tried and it works!!!).Still
> am confused as to why we would neeed to open a channel for each
> consumer.

It's not that you *need* to, it's just that most client libraries don't 
make their channel implementations threadsafe. If you use a library that 
does, or if you have one thread with multiple consumers, you don't need 
to open a channel per consumer.

> The troulble is I have dynamic number of consumers and am
> afraid woudl this approach will scale well( 40 consumers ->  40
> channels).

Channels are slightly more expensive in the server than consumers. But 
only slightly. RabbitMQ is designed to scale to very large numbers of 
channels.

Cheers, Simon

-- 
Simon MacMullen
Staff Engineer, RabbitMQ
SpringSource, a division of VMware



More information about the rabbitmq-discuss mailing list