[rabbitmq-discuss] questions about RpcClient

john doe john.doe44210 at gmail.com
Tue Nov 22 16:22:53 GMT 2011


Ok, now I understand, thanks.

I find strange that primitiveCall do not follow the signature of original
functions, with exchange and routing key provided along with the message.

I am using extensively routing facilities of amqp, and I need to manage
thousands of clients, one per routing key (or do you think creating a
channel and a private queue is cheap enough to be done tens of time per
second?)

I guess you designed this RpcClient class more as an example, to be
customized? That's fine but code of RpcClient is not that simple and I
would have prefered not to maintain that kind of risky low-level things...

Would you consider putting a primitiveCall(String exchange, String
routingKey, AMQP.BasicProperties props, byte[] message) in a future release?

John


2011/11/21 Matthias Radestock <matthias at rabbitmq.com>

> On 21/11/11 09:11, john doe wrote:
>
>> Thank you Matthias.
>> If this class is known to *not* be threadsafe, why is there a
>> "synchronized" statement in primitiveCall? It somewhat confuses me.
>>
>
> That synchronisation is necessary for the coordination of the thread
> issuing a call with the thread on which the reply arrives.
>
> The code calls _channel.basicPublish, which is not threadsafe, outside of
> any synchronisation context. Hence it is not safe to issue calls from
> multiple threads or use the underlying channel in other threads.
>
> Matthias.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20111122/29ac6ca2/attachment.htm>


More information about the rabbitmq-discuss mailing list