[rabbitmq-discuss] multiple routing keys on a queue.

Emile Joubert emile at rabbitmq.com
Thu Mar 31 17:10:41 BST 2011


Hi,

On 30/03/11 15:19, mysurf mail wrote:

> but the message goes only to the first key (did I mention it already?)
>
> Listing queues ...
> amq.gen-4ae4QUbSNevC/RgM+8C9CA==        0
> amq.gen-sgZK0bSc0W3QEXda8m1vIQ==        0
> PositionsQueue  1
> ...done.
>
> rabbitmqctl.bat list_bindings
>
> Listing bindings ...
>          exchange        PositionsQueue  queue   PositionsQueue  []
>          exchange        amq.gen-4ae4QUbSNevC/RgM+8C9CA==        queue   amq.gen-4ae4QUbSNevC/RgM+8C9CA==
>          exchange        amq.gen-sgZK0bSc0W3QEXda8m1vIQ==        queue   amq.gen-sgZK0bSc0W3QEXda8m1vIQ==
> Positions_Exchange      exchange        amq.gen-4ae4QUbSNevC/RgM+8C9CA==        queue   Account:Account1
> Positions_Exchange      exchange        amq.gen-4ae4QUbSNevC/RgM+8C9CA==        queue   Portfolio:Portfolio1
> ...done.

I assume you are publishing to the "Positions_Exchange" exchange with a 
routing key of "Account:Account1" or "Portfolio:Portfolio1". Messages 
will end up in queue "amq.gen-4ae4QUbSNevC/RgM+8C9CA==" in either case.

If you are expecting one publish command to produce two messages in the 
same queue then that won't happen. See the documentation of queue.bind:

http://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.bind

In particular:

"""
A server MUST not deliver the same message more than once to a queue, 
even if the queue has multiple bindings that match the message.
"""


-Emile


More information about the rabbitmq-discuss mailing list