[rabbitmq-discuss] Direct vs Topic Exchange (1:1 and 1:M Chat)

Michael Klishin mklishin at gopivotal.com
Fri May 23 13:18:29 BST 2014


 On 23 May 2014 at 15:20:36, Sunny Dyal (sunny.dyal at gmail.com) wrote:
> > There are two users A and B and two nodes N1 and N2. There are two  
> chat apps 1) chat1 connected with N1 2) chat2 connected with N2  
>  
> User A login in chat1, User B login in chat1 and user A login in chat2  
> again
>  
> If I use amq.topic and start communication I can see messages  
> on all the places but the same scenario does not work with amq.direct.  
>  
> @Question: can we use direct exchange for this scenario?

Every location would use its own queue and bind
it to a direct exchange using username as routing key.
Then a message published with routing key = "joe" will be routed
to 1 or more queues, one for every location.

It does not matter what RabbitMQ node clients connect to, besides
data locality (a queue has a master node and all operations go through it).

I'd recommend using topic exchanges if you feel they make more sense to you.
It's very likely that if you need to optimise things, routing won't be the
main cause.
--  
MK  

Software Engineer, Pivotal/RabbitMQ


More information about the rabbitmq-discuss mailing list