[rabbitmq-discuss] Consume

Emile Joubert emile at rabbitmq.com
Fri Oct 14 10:33:03 BST 2011


Hi Yann,

On 13/10/11 20:00, Yann Luppo wrote:

> To clarify, in our current scenario after processing, the consumer logic
> requeues the message. The goal is to have a given set of messages being
> processed over and over again in a cycle.

That sounds unusual. What is the criteria for stopping processing? A
different pattern for multiple rounds of processing is to have a queue
for each round of processing and for consumers to republish the message
to the next queue in a chain.

You should also avoid relying on the current (v 2.6.1) requeue behaviour
of rabbit which requeues messages at the back of the queue. To guarantee
that messages return to the back of the queue you should acknowledge and
republish instead of requeue.

> After a while I decided that my implementation was flawed somewhere, so
> for a test I simplified the code and started using the Subscription object:

[...]

> The problem w/ this approach is all our consumers read all the
> messages…. Instead of just dequeuing in a round-robin fashion.
> 
> Could someone point me in the right direction for using RabbitMQ to do a
> round-robin-like distribution?

If you have multiple subscriptions to the same queue then consider
setting qos on the channel before creating the Subscription (see
IModel.BasicQos). Internally Subscription uses a QueueingBasicConsumer
which will receive all the messages in the queue unless qos is set.



-Emile


More information about the rabbitmq-discuss mailing list