Alexis <br><br>When are you planning to release version for first option?<br><br>Can you explain the second option?<br><br>Thanks<br>Gagan<br><br><div class="gmail_quote">On Mon, Jul 6, 2009 at 11:06 PM, Alexis Richardson <span dir="ltr">&lt;<a href="mailto:alexis.richardson@gmail.com">alexis.richardson@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Gagan<br>
<br>
One way to simplify the subscription management and get rid of &#39;heavy&#39;<br>
churn, is to use &quot;exchange to exchange&quot; bindings. �These are something<br>
we have looked at - I am just checking with the guys to find out of<br>
this solution would work well, and if so then when it will appear.<br>
<br>
Another option would be to create a custom exchange which used<br>
presence to &#39;show&#39; and &#39;hide&#39; queue bindings. �This would be quite<br>
neat, but it would involve some coding.<br>
<font color="#888888"><br>
alexis<br>
</font><div><div></div><div class="h5"><br>
<br>
On Sat, Jul 4, 2009 at 8:07 PM, GAGAN ARORA&lt;<a href="mailto:gaganarora.itm@gmail.com">gaganarora.itm@gmail.com</a>&gt; wrote:<br>
&gt; Alexis,<br>
&gt;<br>
&gt; Thanks for your wonderful support and solutions.<br>
&gt;<br>
&gt; Firstly answers to your queries:<br>
&gt;<br>
&gt; 1. Are you using fanout exchanges for this (if you want one exchange<br>
&gt; per user, then the answer should be &#39;yes&#39;).<br>
&gt;<br>
&gt;&gt;&gt; No I am using topic exchanges because there will be three type of<br>
&gt;&gt;&gt; bindings of a queue with an excajnde. One for publishing messages to all<br>
&gt;&gt;&gt; users, another for one to one messaging and third for publishing message to<br>
&gt;&gt;&gt; a set of users.<br>
&gt;<br>
&gt; 2. Where is the RabbitMQ server running? �Is it on Server 1 or 2, or<br>
&gt; is it on a 3rd server? �It may not be that important but it would be<br>
&gt; good to know.<br>
&gt;<br>
&gt;&gt;&gt; RabbitMQ Server is running on 3rd Server.<br>
&gt;<br>
&gt;<br>
&gt; Back to original problem.<br>
&gt;<br>
&gt; Actually I thought of the solution provided by you before posting the query<br>
&gt; to you. But if I follow this solution I have to perform following steps<br>
&gt; whenever a user comes online:<br>
&gt; 1. Create a queue.<br>
&gt; 2. Create a binding of newly created queue with all exchanges of other users<br>
&gt; for retrieving messages published by other users.<br>
&gt; 3. Creating a binding with exchange of all users for one to one messaging.<br>
&gt; 4. Create a binding with exchanges of a set of users.<br>
&gt;<br>
&gt; When user goes offline following operation is to be performed:<br>
&gt; 1. Delete all the existing bindings of a queue.<br>
&gt; 2. Deleting the queue.<br>
&gt;<br>
&gt; Actually I want my online and offline processes light weighted. According to<br>
&gt; me this solution would have a high impact on performance and will increase<br>
&gt; time to come online and offline.<br>
&gt;<br>
&gt; Kindly let me know if this can be achieved in some other manner.<br>
&gt;<br>
&gt; Thanks<br>
&gt; Gagan Arora<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Sat, Jul 4, 2009 at 3:23 PM, Alexis Richardson<br>
&gt; &lt;<a href="mailto:alexis.richardson@gmail.com">alexis.richardson@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Gagan,<br>
&gt;&gt;<br>
&gt;&gt; Hi - thank-you for sending the diagram and information which was very<br>
&gt;&gt; useful. �There are several ways to implement the &#39;twitter style&#39;<br>
&gt;&gt; pattern that you have described. �See below for one way to do it that<br>
&gt;&gt; illustrates the AMQP model. �It may not be the most efficient solution<br>
&gt;&gt; in terms of performance as I shall point out.<br>
&gt;&gt;<br>
&gt;&gt; Two quick questions:<br>
&gt;&gt;<br>
&gt;&gt; 1. Are you using fanout exchanges for this (if you want one exchange<br>
&gt;&gt; per user, then the answer should be &#39;yes&#39;).<br>
&gt;&gt;<br>
&gt;&gt; 2. Where is the RabbitMQ server running? �Is it on Server 1 or 2, or<br>
&gt;&gt; is it on a 3rd server? �It may not be that important but it would be<br>
&gt;&gt; good to know.<br>
&gt;&gt;<br>
&gt;&gt; OK - to your cases -<br>
&gt;&gt;<br>
&gt;&gt; Case1: User B sending his message to UserB Exchange which will route<br>
&gt;&gt; message to User A queue but User A is not connected to any of servers.<br>
&gt;&gt; At this point of �all messages sent to Queue A should be dropped.<br>
&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; One way to do this is to identify the lifecycle of Queue A with the<br>
&gt;&gt; &gt;&gt;&gt; presence of User A on servers 1 and 2. �In other words, when User A is not<br>
&gt;&gt; &gt;&gt;&gt; connected to server 1, and also not connected to server 2, then Queue A does<br>
&gt;&gt; &gt;&gt;&gt; not exist. �Note - This is not the only way to achieve what you want but it<br>
&gt;&gt; &gt;&gt;&gt; may be the least fiddly :-)<br>
&gt;&gt;<br>
&gt;&gt; Case2: User A connected to server 1 but UserA consumer is not yet<br>
&gt;&gt; subscribed to UserA queue. If UserB sends any message to its exchange<br>
&gt;&gt; which is routed to Queue of UserA. At this moment of time I want all<br>
&gt;&gt; messages to be stored in queue.<br>
&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; One way to do this (continuing from the above) is to create Queue A<br>
&gt;&gt; &gt;&gt;&gt; immediately after UserA connects to server 1. �This is an action that server<br>
&gt;&gt; &gt;&gt;&gt; 1 can initiate on behalf of UserA. �After Queue A has been created, then it<br>
&gt;&gt; &gt;&gt;&gt; should be bound to all exchanges from which it will receive messages, such<br>
&gt;&gt; &gt;&gt;&gt; as UserB&#39;s exchange. �This will then have the stated effect you seek &quot;If<br>
&gt;&gt; &gt;&gt;&gt; UserB sends any message to its exchange [it] is routed to Queue of UserA.&quot;.<br>
&gt;&gt; &gt;&gt;&gt; �Also, because UserA&#39;s consumer has not yet started consuming messages from<br>
&gt;&gt; &gt;&gt;&gt; Queue A, the messages will all remain stored in the queue.<br>
&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; In addition, if instead of proceeding to Case 3, we revert to Case 1,<br>
&gt;&gt; &gt;&gt;&gt; for example User A disconnects from Server 1, then Queue A can simply be<br>
&gt;&gt; &gt;&gt;&gt; deleted (along with its contents). �(See also Case 5 below)<br>
&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; However - while simple, the above is possibly not the most performant<br>
&gt;&gt; &gt;&gt;&gt; solution if (a) you are running RabbitMQ in clustered mode and (b) your<br>
&gt;&gt; &gt;&gt;&gt; Users generally follow a lot of other Users and (c) they connect and<br>
&gt;&gt; &gt;&gt;&gt; disconnect frequently. �This is because the effect of (c) is to frequuently<br>
&gt;&gt; &gt;&gt;&gt; update the routing table, possibly with a lot of binding/routing data (b),<br>
&gt;&gt; &gt;&gt;&gt; and then replicating it across the cluster (a).<br>
&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; Let us know if you want more info about other ways to do this.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Case3: User A is connected to both servers and UserA consumer is<br>
&gt;&gt; subscribed to UserA queue. If UserB sends any message to its exchange<br>
&gt;&gt; which is routed to Queue of UserA. At this moment of time I want all<br>
&gt;&gt; messages stored in queue to be delievered plus any other incoming<br>
&gt;&gt; message should also be routed.<br>
&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; In any case, to achieve this, just start consuming messages from Queue<br>
&gt;&gt; &gt;&gt;&gt; A.<br>
&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; I assume by &#39;delivered&#39;, you mean &#39;delivered to UserA&#39;s consumer&#39;.<br>
&gt;&gt; &gt;&gt;&gt; �Where is that running?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Case4: User A is connected to both servers and UserA consumer is<br>
&gt;&gt; subscribed to UserA queue. Now User disconnects from Server 2. If<br>
&gt;&gt; UserB sends any message to its exchange which is routed to Queue of<br>
&gt;&gt; UserA. Again I want to store all messages.<br>
&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; To achieve this, just stop consuming messages from Queue A. �They will<br>
&gt;&gt; &gt;&gt;&gt; be stored in Queue A.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Case5: If user A is disconnected from both servers. Initial state is<br>
&gt;&gt; achieved again.<br>
&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; When User A disconnects from Server 1, then Server 1 can tell RabbitMQ<br>
&gt;&gt; &gt;&gt;&gt; to delete Queue A (along with its contents)<br>
&gt;&gt;<br>
&gt;&gt; Cheers,<br>
&gt;&gt;<br>
&gt;&gt; alexis<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Fri, Jul 3, 2009 at 5:05 PM, GAGAN ARORA&lt;<a href="mailto:gaganarora.itm@gmail.com">gaganarora.itm@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; Hi Alexis<br>
&gt;&gt; &gt; Attaching a doc having architecture diagram and cases desired. Hope this<br>
&gt;&gt; &gt; would make things more clear to you.<br>
&gt;&gt; &gt; Thanks<br>
&gt;&gt; &gt; Gagan Arora<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Fri, Jul 3, 2009 at 8:23 PM, Alexis Richardson<br>
&gt;&gt; &gt; &lt;<a href="mailto:alexis.richardson@gmail.com">alexis.richardson@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Gagan,<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; I&#39;m a bit confused about what you are trying to do. �I think what you<br>
&gt;&gt; &gt;&gt; describe is possible but I am not sure what role is being played by<br>
&gt;&gt; &gt;&gt; your two servers. �Is RabbitMQ running on both of them, one of them,<br>
&gt;&gt; &gt;&gt; or neither? �You may find it easier to just use one RabbitMQ server.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Can you send a drawing of what your desired configuration is?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; alexis<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Fri, Jul 3, 2009 at 3:08 PM, GAGAN ARORA&lt;<a href="mailto:gaganarora.itm@gmail.com">gaganarora.itm@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt; Hi<br>
&gt;&gt; &gt;&gt; &gt; I am developing a system in which a user will connect to two servers.<br>
&gt;&gt; &gt;&gt; &gt; On<br>
&gt;&gt; &gt;&gt; &gt; connecting to first server he will become online and will send his<br>
&gt;&gt; &gt;&gt; &gt; presence<br>
&gt;&gt; &gt;&gt; &gt; update but he will receive presence updates only once he is connected<br>
&gt;&gt; &gt;&gt; &gt; to<br>
&gt;&gt; &gt;&gt; &gt; other server as his consumer subscribes to his queue after connecting<br>
&gt;&gt; &gt;&gt; &gt; to<br>
&gt;&gt; &gt;&gt; &gt; second server.<br>
&gt;&gt; &gt;&gt; &gt; I am using one exchange and one queue per user. So if one user comes<br>
&gt;&gt; &gt;&gt; &gt; online<br>
&gt;&gt; &gt;&gt; &gt; then he will send his presence update to his exchange and users bound<br>
&gt;&gt; &gt;&gt; &gt; to<br>
&gt;&gt; &gt;&gt; &gt; that will receive updates.<br>
&gt;&gt; &gt;&gt; &gt; I need to configure a queue which would hold messages for user who<br>
&gt;&gt; &gt;&gt; &gt; has<br>
&gt;&gt; &gt;&gt; &gt; just<br>
&gt;&gt; &gt;&gt; &gt; came online until he is connected to other server. After connecting<br>
&gt;&gt; &gt;&gt; &gt; to<br>
&gt;&gt; &gt;&gt; &gt; second server all messages will be consumed. All messages sent to<br>
&gt;&gt; &gt;&gt; &gt; queue<br>
&gt;&gt; &gt;&gt; &gt; will<br>
&gt;&gt; &gt;&gt; &gt; be dropped once user goes offline.<br>
&gt;&gt; &gt;&gt; &gt; Is it possible?<br>
&gt;&gt; &gt;&gt; &gt; Thanks<br>
&gt;&gt; &gt;&gt; &gt; Gagan Arora<br>
&gt;&gt; &gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; &gt; rabbitmq-discuss mailing list<br>
&gt;&gt; &gt;&gt; &gt; <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
&gt;&gt; &gt;&gt; &gt; <a href="http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>