Alexis<div><br></div><div>But my design says queue must be �bind to an exchange when user is created and not at time User connects to server 1.</div><div><br></div><div>Gagan<br><br><div class="gmail_quote">On Tue, Jul 7, 2009 at 2:25 AM, 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="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Mon, Jul 6, 2009 at 8:17 PM, GAGAN ARORA&lt;<a href="mailto:gaganarora.itm@gmail.com">gaganarora.itm@gmail.com</a>&gt; wrote:<br>

&gt; Alexis<br>
&gt;<br>
</div><div class="im">&gt; Actually dropping out messages from queue is another problem I am facing and<br>
&gt; is following it on another thread with you. In this case I am assuming there<br>
&gt; is no dropping� out of messages from queue if there is no consumer is<br>
&gt; listening to the queue and a message is always queued up in queue.<br>
<br>
</div>Messages will get dropped by an exchange X instead of being put in a<br>
queue Q, when Q is not bound to X.<br>
<br>
So to go through your case:<br>
<div class="im"><br>
&quot;Case1: User B sending his message to UserB Exchange which will route<br>
message to User A queue but User A is not connected to any of servers.<br>
�At this point of �all messages sent to Queue A should be dropped.&quot;<br>
<br>
</div>The property you want is:<br>
<br>
* When User A is not connected to any of servers<br>
* Then all messages sent to Queue A should be dropped<br>
<br>
This is true IF when User A is not connected to any of the servers,<br>
THEN queue A is not bound to any exchanges.<br>
<br>
This has *nothing* to do with consumers or what they are &#39;listening&#39; to.<br>
<br>
So - when User A is not connected then (if above) messages for A get<br>
dropped. �Easy peasy.<br>
<font color="#888888"><br>
alexis<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
<br>
<br>
&gt; Thanks<br>
&gt; Gagan<br>
&gt;<br>
&gt; On Tue, Jul 7, 2009 at 12:03 AM, 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; On Mon, Jul 6, 2009 at 7:02 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; Alexis<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; a) when the User A is not logged into server 1 or server 2, any<br>
&gt;&gt; &gt; messages sent to them by User B are discarded<br>
&gt;&gt; &gt;&gt;&gt; Actually during this case no consumer would be listening to User A<br>
&gt;&gt; &gt;&gt;&gt; queue<br>
&gt;&gt; &gt;&gt;&gt; and hence the messages can&#39;t be discarded and would be queued in<br>
&gt;&gt; &gt;&gt;&gt; Queue.<br>
&gt;&gt;<br>
&gt;&gt; In your document you said:<br>
&gt;&gt;<br>
&gt;&gt; &quot;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.&quot;<br>
&gt;&gt;<br>
&gt;&gt; If this is happening then the messages will be discarded and not<br>
&gt;&gt; queued in Queue.<br>
&gt;&gt;<br>
&gt;&gt; alexis<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; &gt; b) but, when User A is logged in to server 1, any messages sent by<br>
&gt;&gt; &gt; User B that may be routed to User A are queued in Queue A,<br>
&gt;&gt; &gt;&gt;&gt; No of messages increases.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; c) .... delivered when User A logs into server 2.<br>
&gt;&gt; &gt;&gt;&gt; A large no of messages get delieverd.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; It is a constraint in my system that I have to initialize consumer when<br>
&gt;&gt; &gt; User<br>
&gt;&gt; &gt; A connects to Server2.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Mon, Jul 6, 2009 at 9:28 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; As I understood from your document:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; a) when the User A is not logged into server 1 or server 2, any<br>
&gt;&gt; &gt;&gt; messages sent to them by User B are discarded<br>
&gt;&gt; &gt;&gt; b) but, when User A is logged in to server 1, any messages sent by<br>
&gt;&gt; &gt;&gt; User B that may be routed to User A are queued in Queue A, and then<br>
&gt;&gt; &gt;&gt; ...<br>
&gt;&gt; &gt;&gt; c) .... delivered when User A logs into server 2.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Provided that you can implement this efficiently (see other email)<br>
&gt;&gt; &gt;&gt; then the consumer at User A only needs to discard messages that are<br>
&gt;&gt; &gt;&gt; older than one minute, and that were not already discarded due to (a)<br>
&gt;&gt; &gt;&gt; above. �So unless the time interval between A logging into server 1,<br>
&gt;&gt; &gt;&gt; and A logging into server 2, is &quot;quite long&quot; then the &#39;timestamp&#39;<br>
&gt;&gt; &gt;&gt; method adds very little overhead.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Is that correct or have I missed something?<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;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Sat, Jul 4, 2009 at 8:28 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 Alexis<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; My system is similar to an IM system and is using RabbitMQ for<br>
&gt;&gt; &gt;&gt; &gt; presence<br>
&gt;&gt; &gt;&gt; &gt; updates and have designed it in such a way that a consumer subscribes<br>
&gt;&gt; &gt;&gt; &gt; to<br>
&gt;&gt; &gt;&gt; &gt; a<br>
&gt;&gt; &gt;&gt; &gt; queue only when it comes online.Now the issue is as stated by you<br>
&gt;&gt; &gt;&gt; &gt; there<br>
&gt;&gt; &gt;&gt; &gt; will<br>
&gt;&gt; &gt;&gt; &gt; be a large no of messages ready to be deleivered when a user comes<br>
&gt;&gt; &gt;&gt; &gt; online.<br>
&gt;&gt; &gt;&gt; &gt; Checking timestamp for each message will result in high cost.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; There can be a solution in which a message can be published using<br>
&gt;&gt; &gt;&gt; &gt; immediate<br>
&gt;&gt; &gt;&gt; &gt; flag. But it is desired by consumer to get all messages which are<br>
&gt;&gt; &gt;&gt; &gt; less<br>
&gt;&gt; &gt;&gt; &gt; than<br>
&gt;&gt; &gt;&gt; &gt; 1 minute old.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Can you suggest some other solution for achieving this?<br>
&gt;&gt; &gt;&gt; &gt;<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;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; On Sat, Jul 4, 2009 at 3:32 PM, Alexis Richardson<br>
&gt;&gt; &gt;&gt; &gt; &lt;<a href="mailto:alexis.richardson@gmail.com">alexis.richardson@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Gagan,<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; On Fri, Jul 3, 2009 at 5:08 PM, GAGAN<br>
&gt;&gt; &gt;&gt; &gt;&gt; ARORA&lt;<a href="mailto:gaganarora.itm@gmail.com">gaganarora.itm@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Hi Alexis<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; The problem statement here is I dont want my messages in queue for<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; more<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; than<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; 1 minute.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; The easiest way to do this is for the client to keep consuming the<br>
&gt;&gt; &gt;&gt; &gt;&gt; messages from the queue.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; However: presumably you want messages to be ignored in the case<br>
&gt;&gt; &gt;&gt; &gt;&gt; where<br>
&gt;&gt; &gt;&gt; &gt;&gt; (a) there is no consumer to get the messages from the queue; and (b)<br>
&gt;&gt; &gt;&gt; &gt;&gt; the messages are more than one minute old.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; If so then: Have you considered putting a timestamp on the messages?<br>
&gt;&gt; &gt;&gt; &gt;&gt; That way, when a consumer starts taking messages from the queue, it<br>
&gt;&gt; &gt;&gt; &gt;&gt; can simply check the timestamps and throw away anything &#39;old&#39;. �This<br>
&gt;&gt; &gt;&gt; &gt;&gt; solution works just fine when (i) you don&#39;t need real time accuracy<br>
&gt;&gt; &gt;&gt; &gt;&gt; ie. &quot;about a minute&quot; is just as good as &quot;exactly a minute&quot;, and<br>
&gt;&gt; &gt;&gt; &gt;&gt; provided that (ii) there aren&#39;t too many messages to throw away.<br>
&gt;&gt; &gt;&gt; &gt;&gt; Judging by the document that you sent, both (i) and (ii) are true.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Does this help?<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; alexis<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; I have tried expiration property while publishing a message but<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; later came to know that it is still not implemented. Can you help<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; me<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; out<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; in<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; figuring some alternate approach?<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Thanks<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; Gagan Arora<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; On Fri, Jul 3, 2009 at 8:17 PM, Alexis Richardson<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; &lt;<a href="mailto:alexis.richardson@gmail.com">alexis.richardson@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; Gagan,<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; On Fri, Jul 3, 2009 at 3:10 PM, GAGAN<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; ARORA&lt;<a href="mailto:gaganarora.itm@gmail.com">gaganarora.itm@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; Hi<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; Is it possible to set message time out in Java client API, so<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; that<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; messages<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; drop out from queue after some interval of time if nobody<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; consumes<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; it?.<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; Not yet but this is a feature have been asking for quite a bit.<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; �It&#39;s<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; on our roadmap.<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; There may be other ways to achieve what you want.<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; alexis<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; Thanks<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; Gagan Arora<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt; rabbitmq-discuss mailing list<br>
&gt;&gt; &gt;&gt; &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;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &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;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<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></div>