Deal of the Day

Home » Main » Manning Forums » 2010 » RabbitMQ in Action

Thread: Queue with no binding gets all the messages?

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 2 - Pages: 1 - Last Post: Mar 8, 2012 2:10 PM by: Erlanger
Erlanger

Posts: 9
Registered: 3/8/12
Queue with no binding gets all the messages?
Posted: Mar 8, 2012 1:40 PM
  Click to reply to this thread Reply

This is a question regarding the example in Listing 3.1 in the latest version of the book (downloaded March 7 2012)

There are three queues declared, two queues bound to routing keys, as show in the following code example from the book.
$channel->queue_declare('msg-inbox-errors',
false, true, false, false);
$channel->queue_declare('msg-inbox-logs',
false, true, false, false);
$channel->queue_declare('all-logs', false,
true, false, false);


$channel->queue_bind('msg-inbox-errors',
'logs-exchange', 'error.msg-inbox');
$channel->queue_bind('msg-inbox-logs',
'logs-exchange', '*.msg-inbox');

THE QUESTION IS: why the "all-logs" queues are getting all message as indicated in the listing result even though that queue has no binding rule declared?

Listing queues ...
msg-inbox-logs 0
msg-inbox-errors 0
all-logs 3
...done.

Than you.

alvaro.videla

Posts: 13
From: Shanghai
Registered: 11/21/10
Re: Queue with no binding gets all the messages?
Posted: Mar 8, 2012 1:46 PM   in response to: Erlanger in response to: Erlanger
  Click to reply to this thread Reply

Hi,

This seems a bit confusing but the idea of the script is just to explore the queues and bindings using the rabbitmqctl command.

Also a queue with no bindings can get messages if you publish them to the anonymous exchange using the queue name as routing key.

So the 3 there is just as an example.

Erlanger

Posts: 9
Registered: 3/8/12
Re: Queue with no binding gets all the messages?
Posted: Mar 8, 2012 2:10 PM   in response to: alvaro.videla in response to: alvaro.videla
  Click to reply to this thread Reply

Thank you for your reply.

As I read along, I got your point that each queue is bound to the anonymous exchange using the queue name as the routing key.

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor