[rabbitmq-discuss] Multiple listener over single connection in rabbitmq-c.

Alan Antonuk alan.antonuk at gmail.com
Tue Feb 18 18:35:38 GMT 2014


On Tue, Feb 18, 2014 at 2:14 AM, Michael Klishin <mklishin at gopivotal.com>wrote:

>
> On 18 Feb 2014, at 04:40, Sampat Patle <sampatkumar04 at gmail.com> wrote:
>
> > I am new to rabbitmq. I would like to know whether is it possible to
> have multiple channels and multiple listener over single connection using
> threads.
>
> You can have multiple channels per connection (in fact, that's the whole
> point of channels)
> and multiple consumers per connection (or channel). This can be combined
> with threads.
>
> Concurrency safety rule of thumb is: don't share channels between threads,
> especially
> when publishing. Having N threads, 1 per consumer, on the same channel may
> be safe
> depending on client implementation.
>

For rabbitmq-c: a amqp_connection_state_t (a 'connection') should not be
used between different threads without synchronization. If you want to have
multiple consumers over a single connection, my suggestion is to have a
single thread manage consuming from all of the consumers over one
connection, then dispatch the messages to different threads for processing
as necessary.

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140218/2fae6284/attachment.html>


More information about the rabbitmq-discuss mailing list