[rabbitmq-discuss] Possible bug in Priority Queue plugin

Steven Blanc steven.blanc at avid.com
Thu Jul 10 19:02:57 BST 2014

Hi Michael,

Nope, I did mean BasicConsume/BasicConsumeMessage.  
I could have done this with BasicGet but I used BasicConsume followed by a looping BasicConsumeMessage.  In SimpleAmqpClient BasicConsumeMessage will wait for a message from the broker, where BasicGet will simply return false if no message is present. 

Here is the gist of my consumer.  The producer has no sleep and will pile up its messages (with BasicPublish) much quicker than this is supposed to consume them, thus allowing messages with low priority to build up for the occasional high priority message to arrive and be inserted above them.

    channel->BasicConsume(queue_name, consumerTag, true, false, false, /*prefetch*/1);

    for(int i = 0; i < repetitions; i++)
        Envelope::ptr_t myEnvelope = channel->BasicConsumeMessage(consumerTag);
	  BasicMessage::ptr_t msg_out = myEnvelope->Message();

        // ACK the message


-----Original Message-----
From: Michael Klishin [mailto:mklishin at gopivotal.com] 
Sent: Wednesday, July 09, 2014 8:07 AM
To: Steven Blanc; Legacy list about RabbitMQ
Subject: Re: [rabbitmq-discuss] Possible bug in Priority Queue plugin

 On 9 July 2014 at 16:03:16, Steven Blanc (steven.blanc at avid.com) wrote:
> > I am making sure messages back up in the queue by producing with  
> no
> delay and consuming with a 1 second delay between calls to BasicConumeMessage.  

Just to clarify: do you mean basic.get? basic.consume creates a "push" subscription (RabbitMQ will
push messages to the client), so it doesn't need to be run multiple times.

Staff Software Engineer, Pivotal/RabbitMQ

More information about the rabbitmq-discuss mailing list