Erlanger (9) [Avatar] Offline
#1
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 (13) [Avatar] Offline
#2
Re: Queue with no binding gets all the messages?
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 (9) [Avatar] Offline
#3
Re: Queue with no binding gets all the messages?
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.