[rabbitmq-discuss] Advice on where to reset connection and channel

cw storm cwstorm at gmail.com
Sun Feb 16 15:50:18 GMT 2014


MK,

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".


On Sun, Feb 16, 2014 at 1:44 AM, Michael Klishin <mklishin at gopivotal.com>wrote:

>
> On 16 Feb 2014, at 09:09, cw storm <cwstorm at gmail.com> wrote:
>
> > 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.
>
> JVM language clients that support reconnection, including RabbitMQ Java
> client itself on branch bug14587, have a wrapper connection that
> delegates everything to the underlying connection (so, implements
> com.rabbitmq.client.Connection) and adds a shutdown listener
> that performs recovery:
>
>  * Reconnects (creates a new delegate connection)
>  * Reopens all channels (there is a wrapper Channel as well), including
> various listeners
>  * Recovers queues, exchange, bindings, and consumers (in this order)
>
> > 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?
>
> Not "unexpected cancellation" but when the queue is deleted.
>
> MK
>
> Software Engineer, Pivotal/RabbitMQ
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140216/0fb4d0f3/attachment.html>


More information about the rabbitmq-discuss mailing list