[rabbitmq-discuss] rabbitmq-c examples - producer/consumer work queue not working ???
Michael Klishin
mklishin at gopivotal.com
Fri Jun 13 20:39:02 BST 2014
On 13 June 2014 at 23:32:01, ktran0003 at gmail.com (ktran0003 at gmail.com) wrote:
> > This is a surprise to me. I thought the messages should be sent
> round-robin to both consumers (like the python example) so they
> would not receive everything like a fanout.
> Do I miss something? If this is the way it's supposed to work, how
> I change the code to make it work like a work queue?
This example:
https://github.com/alanxz/rabbitmq-c/blob/master/examples/amqp_producer.c
uses a direct exchange that will deliver a message to multiple queues if multiple
queues were bound with the same routing key (queue names do not matter).
This tutorial:
http://www.rabbitmq.com/tutorials/tutorial-two-python.html
uses the default exchange which all queues are bound to automatically
with routing key = queue name. because 2 queues cannot have the same name,
we cannot get into the situation above.
So make sure the example you use is equivalent to tutorial 2: uses basic.qos = 1 and default
exchange. Or bind queues to amq.direct with different routing keys (but it is
a needless complication for what tutorial 2 covers).
See http://www.rabbitmq.com/tutorials/amqp-concepts.html if something isn't clear.
--
MK
Software Engineer, Pivotal/RabbitMQ
More information about the rabbitmq-discuss
mailing list