[rabbitmq-discuss] Using listeners in json rpc server/client

Matthias Radestock matthias at rabbitmq.com
Wed Mar 30 11:07:25 BST 2011


On 30/03/11 10:54, Alister Morton wrote:
> channel.queueDeclare([emptyStringForQueuename], bool,bool,bool... );
>
> channel.queueBind([emptyStringForQueuename],excName,RoutingKey);
>
> 1. how does the channel know which queue to bind. what if it has two
> queues with random name?
>
> 2. How will I add a new binding to a random named queue?
>
> queueDeclare returns the name of the queue it declared, so you would
> change it to
>
> string qname = channel.queueDeclare([emptyStringForQueuename],
> bool,bool,bool... );
>
> channel.queueBind(qname,excName,RoutingKey);

There is also a concept of "most recently declared queue" for every 
channel. Any operation in which an empty queue name is specified 
references that queue.

So you can actually quite happily create a server-named queue, bind it 
and start consuming from it - all without the client ever needing to 
know the name of that queue.


Regards,

Matthias.


More information about the rabbitmq-discuss mailing list