[rabbitmq-discuss] Routing on multiple criteria but hitting only one consumer

Emile Joubert emile at rabbitmq.com
Mon Apr 16 13:39:54 BST 2012


Hi Graham,

On 16/04/12 12:51, Graham Jones wrote:
> On 16/04/2012, at 7:58 PM, Emile Joubert wrote:
>> On 15/04/12 10:04, AgileZebra wrote:
>> 
>>> * We have host1 and host2. * Host1 handles jobs of classA and
>>> classB; host2 handles jobs of classB and classC. * If we route a
>>> job of classA, only host1 will pick it up; if we route a job of
>>> classB, either host1 or host2 will pick it up (based on their 
>>> current load / first available) but never both.
>> 
>> Can you constrain the routing so that messages are only routed to
>> one queue, and you have one queue per class? Then host1 can
>> subscribe to the queues for classA and classB, and host2 can
>> subscribe to the queues for classB and classC.
> 
> Unfortunately not - there are tens of thousands of 'classes' and only
> tens of worker hosts.

Bear in mind that consumers are permitted to subscribe to multiple queues.

There is no way of restricting the delivery of multiple copies of a
message so that only a single consumer receives a single copy of the
message. If a message is routed to multiple queues then the broker will
attempt to deliver all copies independently.

You should reconsider the meaning of messages, which may be too heavily
overloaded.  Possibly introduce a message type that means "piece of work
to be performed once on a single host", and constrain the routing of
such messages appropriately.


-Emile







More information about the rabbitmq-discuss mailing list