[rabbitmq-discuss] Fwd: a few json rpc questions

Emile Joubert emile at rabbitmq.com
Fri Jul 15 10:27:20 BST 2011


Hi,

On 14/07/11 07:35, mysurf mail wrote:
> Hi, 

> Can all the clients be configurated with the same queuename ("") and the
> same routing key (the same for all)? 

There are two queues required for an RPC call over AMQP. The first is
the work queue for the service. The request published by the RPC client
needs to end up in this queue and be consumed by the RPC server. The
second is the callback queue. This is declared by the RPC client and
receives the reply from the RPC server.

When multiple RPC clients are making use of the same RPC service then
they should all use the same routing key so that all requests for that
service go to the same work queue. This is called RPC_QUEUE_NAME in the
relevant Java tutorial:

http://www.rabbitmq.com/tutorials/tutorial-six-java.html

When you make use of RpcClient in the Java client (see

http://hg.rabbitmq.com/rabbitmq-java-client/file/default/src/com/rabbitmq/client/RpcClient.java
)

you will see each client declares its own callback queue, so these are
not shared. If a queue is declared with an empty name then the server
assigns a random name. (See the "Temporary Queues" explanation in the
3rd tutorial.) So even if it looks like all the clients are declaring
the same queue named "", they are all using different callback queues.
This is the recommended approach.


-Emile


More information about the rabbitmq-discuss mailing list