[rabbitmq-discuss] Process N messages / VM concurrently

Ben Hood 0x6e6562 at gmail.com
Sat Jul 5 01:31:40 BST 2008


On Fri, Jul 4, 2008 at 7:53 PM, Joern <opendev at gmail.com> wrote:
> Hi Ben,
> 2008/7/4 Ben Hood <0x6e6562 at gmail.com>:
>> That *may* not be such a good idea because the interaction within a
>> channel is conversational. You may run into trouble when executing
>> synchronous calls within the channel (queue declaration and binding
>> for example).
> I wasn't aware of that - this complicates things obviously. I'll come
> back to the list as soon as things are running (using Spring).

I don't see how this complicates things - after all, you have a simple
1:1 mapping between a thread and a channel. Such is the intention of
the AMQP model. Furthermore, since the thread mapping is so simple and
straight forward, you never have do any locking on any channel object,
since you have eliminated race conditions but have maintained

A crude way of mapping a channel to a thread (in Java) is to stick the
channel reference in the thread local and make sure that you perform
any synchronous operations eagerly in a single threaded fashion or
lazily in a thread safe fashion. I'm sure you can think of more
elegant ways to use a channel in a single threaded fashion.



More information about the rabbitmq-discuss mailing list