[rabbitmq-discuss] Implementing an RPC backend

Matthias Radestock matthias at lshift.net
Sun Jul 8 07:22:05 BST 2007


Ben,

"Ben Hood" <0x6e6562 at gmail.com> writes:

> @Override
> public void handleDelivery(AMQP.Basic.Deliver method,
> AMQP.BasicProperties properties, byte[] body) throws IOException {
>
>             channel.basicPublish(ticket, "foo", properties.replyTo,
> ChannelN.BASIC_PROPERTIES, "bar".getBytes());
>
> }
>
> However, the RPC client still blocks on it's own consumption of the
> reply, indicating that the reply wasn't published correctly.

I suspect that in the 1.0.0-alpha client the above results in a
deadlock. A thread dump should tell you whether that is the case.

One way to get around the deadlock is to let handleDelivery push
requests onto a Java queue, and process that from a different
thread. The next version of the client API has a QueuingConsumer class
for that purpose, and is generally less prone to deadlocks.


Matthias.




More information about the rabbitmq-discuss mailing list