[rabbitmq-discuss] producer/consumer and every n-th message

Torsten Curdt tcurdt at vafer.org
Fri Jul 8 09:05:49 BST 2011


>> That should be easy to implement I assume?
>
> Yes, AMQP 0.9.1 has this feature built-in. See tutorial 2:
>
> http://www.rabbitmq.com/getstarted.html
>
> and a longer example with multiple consumers in the Ruby amqp gem guide:
>
> http://rubydoc.info/github/ruby-amqp/amqp/master/file/docs/Queues.textile#Message_acknowledgements

Great, thanks!

>> I also assume for this scenario a direct exchange would do?
>> How bad would be the contention n and m are fairly large?
>> ...or do I just need to have enough broker?
>>
>
> Sorry, what are n and m?

See above ... the number of producers and consumers.

> Message acknowledgements have very low overhead and
> redeliveries typically do not happen
> often enough to create any contention.

This is more about the fact that many producers and consumers all
share just a single queue.

> Every solution I can think of will require producers to keep track of
> message sequences.

Hm. Is this so uncommon what I am trying to do here? ...consuming only
every n-th message

Another idea could be to create a hash code per message, then use the
modulo of that as the routing key. Not ideal though. And has the
pre-condition that the hashing algorithm produces a good distribution.

One could write his own exchange I assume.
A modified Fanout would probably do the trick.
Just would like to avoid custom code in this area if possible.

> Take a look at http://www.rabbitmq.com/extensions.html#sender-selected-distribution.

Interesting. Thanks for the pointer.

cheers,
Torsten
-- 
http://www.yourdailygeekery.com
http://www.torstencurdt.com


More information about the rabbitmq-discuss mailing list