[rabbitmq-discuss] Routing via user id

Laing, Michael michael.laing at nytimes.com
Sun Jul 13 23:47:19 BST 2014


You should look at the 'consistent-hash-exchange':
http://www.rabbitmq.com/plugins.html

By either using the user id as the routing key or by setting a header to
the user id, messages w a particular user id will always get routed to the
same queue.

Hopefully your input is nicely distributed across the user id space. If
not, there is more work required.

ml


On Sun, Jul 13, 2014 at 11:41 AM, Sean Joyce <seanmjoyce at gmail.com> wrote:

> 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
>
> _______________________________________________
> rabbitmq-discuss mailing list has moved to
> https://groups.google.com/forum/#!forum/rabbitmq-users,
> please subscribe to the new list!
>
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140713/3df07766/attachment.html>


More information about the rabbitmq-discuss mailing list