<div dir="ltr">MK,<div><br></div><div>I'm not sure if I understand you correctly. I know I would have to write the logic to reconnect either in the shutdown listener or the consumer callback "handleShutDownSignal" but not both. If I do but, there's a potential I could have multiple consumer subscription on different channel. I was asking which where is the best place to put the reconnect logic, connection shutdown listener or the consumer callback "handleShutDownSignal".</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Feb 16, 2014 at 1:44 AM, Michael Klishin <span dir="ltr"><<a href="mailto:mklishin@gopivotal.com" target="_blank">mklishin@gopivotal.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><br>
On 16 Feb 2014, at 09:09, cw storm <<a href="mailto:cwstorm@gmail.com">cwstorm@gmail.com</a>> wrote:<br>
<br>
> I don't think I would want to include the function to re-establish the connection/channel in both of the handlers. So, where would I perform the re-connect logic. Maybe I should just pick one.<br>
<br>
</div>JVM language clients that support reconnection, including RabbitMQ Java client itself on branch bug14587, have a wrapper connection that<br>
delegates everything to the underlying connection (so, implements com.rabbitmq.client.Connection) and adds a shutdown listener<br>
that performs recovery:<br>
<br>
* Reconnects (creates a new delegate connection)<br>
* Reopens all channels (there is a wrapper Channel as well), including various listeners<br>
* Recovers queues, exchange, bindings, and consumers (in this order)<br>
<div class=""><br>
> Also, another consumer callback name "handleCancel". This will only be invoke when an unexpected cancellation by the broker. That would also mean I would have to reconsume from the other node by creating another connection/channel. I assume this does not get invoke during a restart of the broker or a force close connection. That would only apply to the two that I mentioned, right?<br>
<br>
</div>Not “unexpected cancellation” but when the queue is deleted.<br>
<br>
MK<br>
<br>
Software Engineer, Pivotal/RabbitMQ<br>
<br>
<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</blockquote></div><br></div>