<div dir="ltr"><br>Hi,<br><br>I am creating an Android app to receive push message from RabbitMQ server with the following<br><br><code class="java plain">queueName</code><code class="java plain"> = "queue123";<br>channel.queueDeclare(queueName, true, false, false, null); //</code><code>durable = true,
exclusive = false,
autoDelete = false<br></code><div class="line number62 index61 alt1"><code class="java spaces">consumer</code><code class="java plain"> = </code><code class="java keyword">new</code> <code class="java plain">QueueingConsumer(channel);</code></div><div class="line number63 index62 alt2"><code class="java spaces">channel</code><code class="java plain">.basicConsume(queueName, </code><code class="java keyword">false</code><code class="java plain">, consumer);<br><br><span style="font-family: arial,sans-serif;">I want to be able to receive message pushed when the connection to Internet is not available, hence, I set the autoDelete attribute to false.</span><br><br><span style="font-family: arial,sans-serif;">When I switch my network connection from one wifi router to another, two consumers are created for the queue as below. </span></code><code class="java plain"><span style="font-family: arial,sans-serif;">In that case, messages will be
distributed between both consumers, hence, the app only receives alternate message until the first connection timeout due to heartbeat setting.<br><br></span></code><h2>Consumers</h2>
<table class="list"><thead>
<tr>
<th>Channel</th>
<th>Consumer tag</th>
<th>Ack required</th>
<th>Exclusive</th>
</tr>
</thead>
<tbody><tr class="alt1">
<td><a href="http://dev.wkl.com:15672/#/channels/210.19.225.88%3A36920%20-%3E%20172.25.0.90%3A5672%20%281%29">210.19.225.88:36920 (1)</a></td>
<td>amq.ctag-ma8QOXnZ_UAK-R7wddQGXA</td>
<td class="c">●</td>
<td class="c">○</td>
</tr>
<tr class="alt2">
<td><a href="http://dev.wkl.com:15672/#/channels/210.19.225.3%3A60659%20-%3E%20172.25.0.90%3A5672%20%281%29">210.19.225.3:60659 (1)</a></td>
<td>amq.ctag-igoa2WysTs79WAk969UFJg</td>
<td class="c">●</td>
<td class="c">○</td></tr></tbody></table><code class="java plain"><span style="font-family: arial,sans-serif;"> </span></code></div>I am not able to cancel the first consumer with channel.basicCancel(consumerTag) when as the connection has already been closed. Is there any way to overcome this problem?<br><br><br>Regards,<br>--Wong Liong Hung<br></div>