[rabbitmq-discuss] using a topic exchange to route to multiple queues

Daniel Oppenheimer dopp at vlingo.com
Mon Dec 6 04:08:57 GMT 2010



I am writing a java rabbitmq client.  And I am trying to write code that
will publish messages to topic exchanges such that they get delivered to
multiple queues.  Following is the code that I am using:


Channel channel = conn.createChannel();

channel.exchangeDeclare(my_exchange, "topic", true);

channel.queueDeclare(company.my_queue, true, false, false, null);

channel.queueBind(company.my_queue, my_exchange, "company.#" );




channel.basicPublish(my_exchange, "company.#", null, messageBodyBytes);


I would like this code to publish to all queues under company.  That is,
I would like it to publish to company.my_queue and
company.another_queue.  My understanding is that the wild card in the
routing key should route any message published to my_exchange to any
queue prefixed with company.  Is this correct?  If not, what is the
correct way to do what I am trying to accomplish?  Should there be a
wild card in the routing key in both the queueBind and basicPublish
method calls?






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20101205/5a5b7bdf/attachment.htm>

More information about the rabbitmq-discuss mailing list