<br><div class="gmail_quote">On Wed, Jan 16, 2013 at 1:13 PM, Cao, Yican - 0551 - MITLL <span dir="ltr">&lt;<a href="mailto:cao@ll.mit.edu" target="_blank">cao@ll.mit.edu</a>&gt;</span> wrote:</div><div class="gmail_quote">
<br>Hi, Cao:<br><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">My question is what is going to happen to the consumer actually connected to master&#39;s URI when master node is dead. I can understand that consumers connected to original slave&#39;s URI won&#39;t notice any difference. Thanks.<br>
</blockquote><div><br></div><div>Please see here for details: �<a href="http://www.rabbitmq.com/ha.html">http://www.rabbitmq.com/ha.html</a></div><div><br></div><div>You are quite correct in that, regardless of which cluster node a consumer is connected to, the consuming is done from the master node of the mirror set. �In the event of a master failure however, the following sequence of events happens:</div>
<div><ul><li>The eldest slave is promoted to become the new master</li><li>The slave considers *all* previous consumers to have been abruptly disconnected. �As a result all messages that have been delivered to clients but for which receipt of ACK is pending are requeued for redelivery. �This guards against cases where a delivery happened, but the ACK hadn&#39;t reached the master before its failure, or where the receipt of the ACK hadn&#39;t been successfully broadcast to the slaves prior to master failure.</li>
<li>Clients that were consuming from the mirrored queue (regardless of which node they had explicitly connected to) and that support the Consumer Cancellation Notification extension will be notified that their subscription to the mirrored queue has been cancelled. �They must then:</li>
<ul><li>Re-consume from the queue, which will pick up the newly promoted master</li></ul></ul><div>The reason the CCN exists is to inform clients that the master was lost. �</div><div><br></div><div>If the clients aren&#39;t told this, they may continue to ACK messages sent by a now departed master, and they may be surprised by seeing messages a second time (due to the requeuing in the second bullet point above). �If a client happened to be connected directly to the crashed master, he&#39;d of course be disconnected and have to reconnect to a live node in the cluster.</div>
</div><div><br></div><div>So when you say &quot;consumers connected to original slave&#39;s URI won&#39;t notice any difference&quot; that&#39;s not quite entirely true. �Further, the answer to your question about &quot;what is going to happen to the consumer actually connected to master&#39;s URI when master node is dead&quot; is that such a consumer will be disconnected, have to reconnect to the cluster, and reconsume from the queue.</div>
<div><br></div><div>Best regards,</div><div>Jerry</div><div><br></div></div>