You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by unleashed85 <ca...@bradreitmeyer.com> on 2016/01/14 23:29:56 UTC

CAMEL-8742 RabbitMQ consumer reconnect

I'm working on CAMEL-8742 where RabbitMQ consumers will never reconnect if
the RabbitMQ channel gets closed.

Its actually really easy to detect when the channel is closed because the
com.rabbitmq.client.Consumer interface has a handleShutdownSignal() method
that will get called. However I would appreciate some advice on what do when
we detect a remote shutdown.

Should we:
a) Stop the consumers and call restart() (which will start up another thread
to get a connection then start new consumers).
b) Refactor the consumers constructor to pass in a Connection instead of
Channel. Then have the consumer keep trying to get a channel until it
connects again?

The way the code is currently written it would be easy to go with option
A... but it doesn't seem right to stop all the consumer threads and restart
them. Thoughts?



--
View this message in context: http://camel.465427.n5.nabble.com/CAMEL-8742-RabbitMQ-consumer-reconnect-tp5776264.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: CAMEL-8742 RabbitMQ consumer reconnect

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah the other components that can re-connect do it like B. I think we
should refactor the code, which is fine to introduce in Camel 2.17
onwards.

So I suggest to go with B.



On Thu, Jan 14, 2016 at 11:29 PM, unleashed85 <ca...@bradreitmeyer.com> wrote:
> I'm working on CAMEL-8742 where RabbitMQ consumers will never reconnect if
> the RabbitMQ channel gets closed.
>
> Its actually really easy to detect when the channel is closed because the
> com.rabbitmq.client.Consumer interface has a handleShutdownSignal() method
> that will get called. However I would appreciate some advice on what do when
> we detect a remote shutdown.
>
> Should we:
> a) Stop the consumers and call restart() (which will start up another thread
> to get a connection then start new consumers).
> b) Refactor the consumers constructor to pass in a Connection instead of
> Channel. Then have the consumer keep trying to get a channel until it
> connects again?
>
> The way the code is currently written it would be easy to go with option
> A... but it doesn't seem right to stop all the consumer threads and restart
> them. Thoughts?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CAMEL-8742-RabbitMQ-consumer-reconnect-tp5776264.html
> Sent from the Camel Development mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2