[rabbitmq-discuss] New exchange type

Martin Sustrik sustrik at imatix.com
Tue Apr 22 08:05:05 BST 2008


>> Recently I put together a new exchange type for RabbitMQ, because none of
>> the existing ones completely match our requirements. The problem it solves
>> is this: we want a publish-subscribe model where exactly one subscriber
>> receives any given message. If we set up a topic exchange and have all
>> subscribers listen on the same queue, we get this out of the box. But this
>> requires that all messages go to that one queue, which resides on one
>> machine, causing a pretty significant bottleneck. A reasonable way around
>> this was to implement a new exchange type ("anycast") that picks a random
>> queue when a message is routed. The diff and new file for
>> rabbit_exchange.erl are attached.
>>     
I've seen this requirement before, however, AFAICS it breaks AMQP model. 
The exchanges are meant to be used for message distribution, i.e. the 
message should be delivered to *all* queues with appropriate binding to 
the exchange. Queues are intended to do the load-balancing. Not adhering 
to this model causes problems with some more sophisticated use cases 
(wire-tapping, federation). It also introduces a lot of unfairness to 
the load-balancing algorithm. Why do you believe a single queue would 
create a significantly graver bottleneck when compared to a single exchange?

Martin




More information about the rabbitmq-discuss mailing list