<div dir="ltr"><div>Hi,</div>
<div> </div>
<div>I'm trying to understand how AMQP and RabbitMQ works by building a simple chat.</div>
<div>From reading the AMQP specs I get the impression that it's best usage is when someone publish content to an exchange</div>
<div>and someone else bind his queue to this exchange to get updates. This model works very well for publish-subscribe</div>
<div>and to finance systems but chat could be different. I read the xmpp gateway docs and have some questions.</div>
<div> </div>
<div>In a chat we want to be able to get presence from users on our friend-list, send them messages</div>
<div>and send subscription request and messages to users not yet on our friend-list.</div>
<div> </div>
<div>One possibility is that each user will have an exchange and a queue with binding to his own exchange.</div>
<div>When user1 wants to send a message to user2 he send it directly to the exchange of user2.</div>
<div>There is a problem with presence updates. If user1 changes his presence, he'll have to sends the update </div>
<div>to the exchange of all the users on his friend-list. With this design we move the logic to the client rather then use the AMQP features. </div>
<div> </div>
<div>Another option is that when a user logs in he'll create a binding to the exchanges of all the users on his friend-list.</div>
<div>When user1 want to send a private message or a presence update to user2 he'll send it to his own exchange and it'll be directed to user2. The problem with this design is that users without mutual presence subscription can't send private message to each other and can't send subscription requests.</div>
<div> </div>
<div>Can you please share your thoughts on the two options and maybe other design options?</div>
<div> </div>
<div>Thanks</div></div>