[rabbitmq-discuss] Groking the point of queues in topic exchanges

Simon MacMullen simon at rabbitmq.com
Wed Feb 8 10:57:31 GMT 2012

On 07/02/12 22:20, methodin wrote:
> So when I was originally mapping out how to design an implementation
> of RabbitMQ I assumed that an exchange could route messages to queues
> and workers could consume solely off one of the queues. When I added
> two queues in I found out that the message will get sent to both
> queues and those both workers.
> So I implemented a topic exchange and route to queues based on routing
> keys. I am now, however, at a loss in figuring out the point of the
> queues in this system as I could just as easily map 4 different keys
> to the same queue vs. routing each one to their own queue. Is there a
> large difference here? Should I be aiming for one approach vs the
> other?

So we're comparing one topic exchange with multiple routing keys all 
feeding into one queue, versus one topic exchange with multiple routing 
keys each feeding into a separate queue?

There are a couple of differences which may or may not matter to you:

1) If more than one of your routing keys match a given message, that 
message would get duplicated to each queue in the multiple queue case.

2) By pushing all the messages into one queue you impose a total 
ordering on your messages, which you may want. But by splitting out the 
messages into multiple queues you may get better performance (if the 
performance of the queue is a limiting factor...)

Cheers, Simon

Simon MacMullen
RabbitMQ, VMware

More information about the rabbitmq-discuss mailing list