Publish to multiple routing keys

1,787 views
Skip to first unread message

Rambabu

unread,
Aug 18, 2015, 12:53:55 AM8/18/15
to rabbitmq-users
Hi,

Is it possible to publish multiple routing keys?

Eg: Consumer A binded with "A"
      Consumer B binded with "B"

     Can i publish message to A and B at a time?

Thanks

Mohammed Naseef

unread,
Aug 18, 2015, 1:19:10 AM8/18/15
to rabbitmq-users

It is not possible to publish multiple routing keys in a message, but multiple routing criteria can be included in a single routing key.

In the example stated by you,

Consumer A can bind for #.A.#
Consumer B can bind for #.B.#

In this case, a message published with routing key A.B would get routed to both consumers A & B.


Regards,
Mohammed Naseef

Laing, Michael

unread,
Aug 18, 2015, 6:10:42 AM8/18/15
to rabbitm...@googlegroups.com
sender selected distribution is what you are looking for.

We use this to route the same message to multiple recipients.

E.g.:
routing_key: "A"
header.CC: "B"
body: "M"

will route message M to both A and B.

ml

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Klishin

unread,
Aug 18, 2015, 7:38:09 AM8/18/15
to rabbitm...@googlegroups.com, Laing, Michael
On 18 Aug 2015 at 13:10:42, Laing, Michael (michae...@nytimes.com) wrote:
> sender selected distribution (http://www.rabbitmq.com/sender-selected.html)
> is what you are looking for.
>
> We use this to route the same message to multiple recipients.
>
> E.g.:
> routing_key: "A"
> header.CC: "B"
> body: "M"
>
> will route message M to both A and B.

Both Sender-Selected Distribution and topic/fanout exchanges are good options.
The downside of the former is that your publisher needs to be hyperaware of the queues.
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Laing, Michael

unread,
Aug 18, 2015, 7:56:36 AM8/18/15
to Michael Klishin, rabbitm...@googlegroups.com
We use Sender-Selected Distribution with topic exchanges so hyper-awareness of queues is not needed :)
Reply all
Reply to author
Forward
0 new messages