[rabbitmq-discuss] NPE in RpcClient

Matthias Radestock matthias at lshift.net
Fri Apr 4 20:50:13 BST 2008


Neil Ellis wrote:

> That's just how it's done in the Mule connector, it's making use of the 
> same client for RPC calls and non RPC calls. I think Tony put that 
> together so you may want to chat with him, I'm sure Ross would be happy 
> to change it if there is a better strategy.

Actually, using RpcClient.publish should be perfectly safe, if a little 
weird and undocumented. I cannot see the publish would end up placing 
messages in the reply queue of the same RpcClient. The reply queue is 
given a server-generated name and is bound to the default exchange (""), 
which is a direct exchange. To send a message to the reply queue it 
would have to be sent to the default exchange with a routing key equal 
to the generated queue name. Since both the exchange name and routing 
key are supplied to the constructor of the RpcClient there is no way for 
that to happen.

Instead what I suspect might be causing the problem is an rpc server 
replying to a message twice, or perhaps two rpc servers replying to the 
same message. Do you think that can occur in your set up?

The arrival of the second reply would indeed trigger an NPE. That's 
perhaps not the nicest exception to throw under the circumstances, but 
*some* exception is certainly warranted.


More information about the rabbitmq-discuss mailing list