[rabbitmq-discuss] Routing via user id

Sean Joyce seanmjoyce at gmail.com
Sun Jun 22 01:16:28 BST 2014


I have a scenario where one producer publishes a stream of messages to an
exchange. The exchange has 10 queues (there is an upper limit to the amount
of parallel work that can be done - e.g. Database bottleneck) that it
routes messages to. The messages can really go to any queue with one
exception: only one message with a given user id can be processed at a
time.

All messages with that user id should be routed to the same queue. If there
was no database bottleneck I would create a new queue for each user id but
I can really only process ten messages at a time.

I had thought of partitioning the user ids across ten queues but there is
no guarantee the incoming messages would be evenly distributed even with
different user ids. Thus I could have queues 1,4 and 8 with a backlog while
the rest are idle resources.

Any tips on a defined pattern that solves this type of problem so that any
message for a given user id can go to any queue but messages with the same
user id always go to the same queue?

-Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140621/3e16206c/attachment.html>


More information about the rabbitmq-discuss mailing list