[rabbitmq-discuss] rabbitmq-c -- multiple exectables receiving same message

Lowell.Boggs at emc.com Lowell.Boggs at emc.com
Fri Jul 1 15:44:22 BST 2011


That's it!  

I was using "" as the queue name.

Now that I am sharing a queue, they load balancing magically works.

Whew, that sure saved me a lot of debug time.

Thanks!

Lowell 

-----Original Message-----
From: alexis.richardson at gmail.com [mailto:alexis.richardson at gmail.com] On Behalf Of Alexis Richardson
Sent: Friday, July 01, 2011 9:08 AM
To: Boggs Jr., Lowell
Cc: simone.busoli at gmail.com; rabbitmq-discuss at lists.rabbitmq.com
Subject: Re: [rabbitmq-discuss] rabbitmq-c -- multiple exectables receiving same message

Lowell

How many queues do you have bound to the exchange?  You should have
one queue.  Then, connect both executables to that queue.

alexis


On Fri, Jul 1, 2011 at 2:56 PM,  <Lowell.Boggs at emc.com> wrote:
> HI Simon -- thanks for trying to help!
>
> The two executables are not in fact receiving the messages in a round-robin
> fashion.  They are both receiving all of the messages.
>
> I send 4000 messages and both executables receive all 4000 in sequence.  It
> was my understanding that the point of the tutorial was to demonstrate a
> round robin delivery of 1/2 of the messages to each consumer so as to
> accomplish load balancing.  The examples in the tutorial page show that of
> the 5 messages sent as a test, 3 went to one python consumer task and the 2
> going to the other.
>
> Our use of the rabbit-mq entirely depends on this load balancing feature.
> If I can't get this to work like the tutorial, we need to pursue a different
> messaging solution.  I guess I'll have to copy the python examples out of
> the tutorial and see if the tutorial actually works -- maybe the actual
> python source will tell me what I' might be doing wrong.
>
> Thanks,
>    Lowell
>
> ________________________________
> From: Simone Busoli [mailto:simone.busoli at gmail.com]
> Sent: Thursday, June 30, 2011 5:06 PM
> To: Boggs Jr., Lowell
> Cc: rabbitmq-discuss at lists.rabbitmq.com
> Subject: Re: [rabbitmq-discuss] rabbitmq-c -- multiple exectables receiving
> same message
>
> Hi Lowell,
>
> The second tutorial does not use a topic exchange, but even with a topic
> exchange the situation would be the same. The key point here is that your
> workers are reading messages from the same queue. The exchange, topic or
> anything else, as soon as it has delivered a message to a queue is out of
> the game. The queue receives the message because it's bound to the exchange.
> Then you have two or more workers reading from the same queue, thereby
> receiving each one message in a round-robin fashion.
>
> On Jun 30, 2011 11:29 PM, <Lowell.Boggs at emc.com> wrote:
>> I am confused by my experiments with rabbitmq-c.
>>
>> I was trying to follow the task worker tutorial:
>>
>> http://www.rabbitmq.com/tutorials/tutorial-two-python.html
>>
>> Of course, I'm using C interfaces not the python or Java interfaces.
>>
>> Being a newbie it is probable that I'm doing something wrong, but:
>>
>> The tutorial implies to me that if I have:
>>
>> * one exchange+topic
>> * two worker executables that read from it
>>
>> then
>>
>> * due to round-robin processing, some messages will go to one executable
>> * other messages will go to the other
>>
>> However, I am seeing that both exectuables receive all the messages --
>> which is not at all what I want.
>>
>> Is this supposed to work with the default version of rabbitmq-c?
>>
>> Immediately upon logging into the channel, in the consumers, I am setting
>>
>> basic_qos(conn, 1, 0, 1, 0);
>>
>> Also, I am calling basic_consume like this:
>>
>> amqp_basic_consume(conn,
>> 1,
>> amqp_cstring_bytes(queuename),
>> amqp_empty_bytes,
>> 0,
>> 0,
>> 0,
>> amqp_empty_table
>> );
>>
>>
>> The exchange that i am using is amq.direct. I have tried an empty string
>> queue name as well as "hello".
>>
>> I am calling basic_ack() as soon as I receive the messages in both worker
>> executables -- well, after I log their reception.
>>
>> Any ideas?
>>
>> Thanks,
>> Lowell
>>
>>
>>
>>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>



More information about the rabbitmq-discuss mailing list