<div dir="ltr"><div><br></div>�� <br><div><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 31, 2013 at 5:36 PM, Emile Joubert <span dir="ltr">&lt;<a href="mailto:emile@rabbitmq.com" target="_blank">emile@rabbitmq.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Hi,<br>
<br>
On 31/10/13 07:46, Liong Hung Wong wrote:<br>
<br>
&gt; When I switch my network connection from one wifi router to another, two<br>
&gt; consumers are created for the queue as below. In that case, messages<br>
&gt; will be distributed between both consumers, hence, the app only receives<br>
&gt; alternate message until the first connection timeout due to heartbeat<br>
&gt; setting.<br>
<br>
If you want to ensure that only one consumer can get messages from a<br>
queue then set the exclusive flag.<br>
<br></blockquote><div><br>If I set the queue exclusive flag, the new connection/channel can not be
 attached to the queue until the first connection timeout. The queue is a permanent queue so that the 
client doesn&#39;t miss any message published to the queue when the client 
is offline.<br><br>�</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt; I am not able to cancel the first consumer with<br>
&gt; channel.basicCancel(consumerTag) when as the connection has already been<br>
&gt; closed. Is there any way to overcome this problem?<br>
<br>
This should not be a problem. If the connection of one consumer has<br>
already closed by the time the second consumer opened then there will be<br>
no overlap in subscriptions. If consumers subscribe without autoAck then<br>
unacknowledged messages will be returned to the queue when a connection<br>
terminates, and any subsequent consumer will be able to process such<br>
messages.<br>
<span class=""><font color="#888888"><br>
<br></font></span></blockquote><div>The first connection has not been closed on the server although it has been closed on the client side (the close command doesn&#39;t get sent to the server as the network connection is already down). The first connection on the server only gets closed after heartbeat timeout (default 600s). <br>
</div><div><br></div><div>During the 600s, M1, M2, M3 and M4 published to the queue. New connection only get M2, and M4 during the 600s. After the first connection closed, the new connection/channel gets M1 and M3. What I want to achieve is to be able to get all of the messages in real-time.� <br>
</div><div><br></div><div><br></div><div>�</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class=""><font color="#888888">
<br>
-Emile<br>
<br>
<br>
<br>
<br>
</font></span></blockquote></div><br></div></div></div>