[rabbitmq-discuss] using client from different threads

john doe john.doe44210 at gmail.com
Mon Dec 5 13:45:34 GMT 2011


@ Mysurf: I asked almost the same questions about two weeks ago ("questions
about RpcClient")

@ Steve: Nice to see that you are working on improving these classes. I
actually had three major issues with RpcClient:
- the lack of interface which made mocking quite difficult for unit testing
(I had to inherit from the class)
- the fact that the routing key is a final attribute of the class (which
makes me create multiple clients when using several routing keys)
- the lack of a "single request / multiple replies" scenario (with a
expected number of replies and a timeout)


2011/12/5 Steve Powell <steve at rabbitmq.com>

> Hi,
> Since Rabbitmq 2.7.0 it has been  possible to use a channel from multiple
> threads in the Java client, however doing so may block one or other of the
> threads if you are using a synchronous command.
> Since consumers now run their 'callbacks' on threads separate from the
> channel
> and connection threads, it is now possible to call the channel from within
> these callbacks, without deadlocking.  Again, you should understand the
> threading implications.
> 'Using the RpcClient from different threads' is probably a little more
> tricky.
> However, publishes use the channel interface so ought to be OK, although
> all
> RpcClient 'calls' will be serialised, of course.
> We are currently looking to enhance the RpcClient/Server code, to make them
> more flexible (being able to call several servers from one client, for
> example)
> and re-usable (reducing the interface and making it more basic), building
> it on
> the standard interface, rather than using the implementation classes (as it
> does now).  We are, of course, interested in any problems you detect with
> the
> current RpcClient/Server implementations.
> Steve Powell  (a christmas bunny)
> ----------some more definitions from the SPD----------
> avoirdupois (phr.) 'Would you like peas with that?'
> distribute (v.) To denigrate an award ceremony.
> definite (phr.) 'It's hard of hearing, I think.'
> modest (n.) The most mod.
> On 5 Dec 2011, at 10:13, Mysurf Mail wrote:
> > 1. Is it ok to use the same channel from different threads?
> > 2. Is it ok to use RPC client from different threads
> > [I am trying to narrow down on the cause of my problems (usage of close
> rpc queue). ]
> > _______________________________________________
> > rabbitmq-discuss mailing list
> > rabbitmq-discuss at lists.rabbitmq.com
> > https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> _______________________________________________
> 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/20111205/5272c6f2/attachment.htm>

More information about the rabbitmq-discuss mailing list