The amqp_consume example sets no_ack = 1, so the broker sends messages to consumers as fast as possible without waiting for any acknowledgement from clients.<br><div><br></div><div>To make it work more like a work-queue, you'd need to set no_ack = 0, requiring the consumer to send a basic.ack (amqp_basic_ack). In addition you'll also need to set a qos (using amqp_basic_qos) which will limit the number of unacked messages that each consumer can have. (to be pedantic - the qos parameter is per-channel: see: <a href="http://www.rabbitmq.com/consumer-prefetch.html">http://www.rabbitmq.com/consumer-prefetch.html</a> )</div>
<div><br></div><div>-Alan</div><br><div>On Fri Jun 13 2014 at 12:30:38 PM, <<a href="mailto:ktran0003@gmail.com">ktran0003@gmail.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I tried out the producer/consumer examples included in  rabbitmq-c as follows:<br>One producer and two consumers<br><br>In two separate terminal windows:  ./amqp_consumer localhost 5672<br>In one terminal window:  %./amqp_producer localhost 5672 1 6<br>
<br>Both consumers show:<br>6737 ms: Received 1 - 1 since last report (0 Hz)<br>6737 ms: Received 2 - 1 since last report (16949 Hz)<br>7739 ms: Received 3 - 1 since last report (0 Hz)<br>8737 ms: Received 4 - 1 since last report (1 Hz)<br>
9738 ms: Received 5 - 1 since last report (0 Hz)<br>10737 ms: Received 6 - 1 since last report (1 Hz)<br><br>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.<br>
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?<br><br>Thanks,<br>-Kim<br><br><br><br><br></div>______________________________<u></u>_________________<br>

rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com" target="_blank">rabbitmq-discuss@lists.<u></u>rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/<u></u>cgi-bin/mailman/listinfo/<u></u>rabbitmq-discuss</a><br>
</blockquote>