[rabbitmq-discuss] Does rabbitmq support publishing message with a wildcard?
qihang zhang
qihangzp at gmail.com
Thu Apr 10 10:02:30 BST 2014
Hi all,
Does rabbitmq support publishing message with wildcard?
Something I wish like this:
declare(exchange, 'topic')
bind(q1, exchange, 'user1.client1')
bind(q2, exchange, 'user1.client2')
bind(q3, exchange, 'user1.client3')
exchange.publish(msg, routing_key='user1.*') # all of q1, q2, q3 would
receive this msg
exchange.publish(msg, routing_key='user1.client1') # only q1 would receive
this msg
I read the doc and searched about this, found it seems that only binding
with wildcart is supported,
Now I have to write codes like:
declare(exchange_fanout, 'fanout')
bind(q1, exchange_fanout)
bind(q2, exchange_fanout)
bind(q3, exchange_fanout)
declare(exchange_direct, 'direct')
bind(q1, exchange_direct, 'user1.client1')
bind(q2, exchange_direct, 'user1.client2')
bind(q3, exchange_direct, 'user1.client3')
exchange_fanout.publish(msg) # all of q1, q2, q3 would receive this msg
exchange_direct.publish(msg, routing_key='user1.client1') # only q1 would
receive this msg
Is there other clearer way to do these? I think this is a pretty common
thing when we want publish msgs peer-to-peer and peer-to-group.
Many thanks! :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140410/bd7c3361/attachment.html>
More information about the rabbitmq-discuss
mailing list