[rabbitmq-discuss] Java handleShutdownSignal startegy
Rob Harrop
rob at rabbitmq.com
Sat Feb 19 23:20:10 GMT 2011
Abishek,
I think the best strategy will depend on how many consumers you have per
connection and whether you want multiple consumers (if you have them) to
reconnect independently if their channel dies.
If you want to handle channel death on a per consumer basis, then using
handleShutdownSignal on Consumer is fine. You'll need to make sure that
when you open a new channel as part of the retry that you have moved
work off the connection thread. Basically, you need to start a new
thread in handleShutdownSignal before starting to interact with the
connection.
I think a better solution is to use a ShutdownListener that can be
attached to either the channel or the connection (or both). This is
slightly more robust because it will allow retry to happen if the
consumer hasn't yet been created (maybe there is an intermittent failure
during startup).
Regards,
Rob
Abhishek Kona wrote:
> Abishek,
>
> I think the best strategy will depend on how many consumers you have per
> connection and whether you want multiple consumers (if you have them) to
> reconnect independently if their channel dies.
>
> If you want to handle channel death on a per consumer basis, then using
> handleShutdownSignal on Consumer is fine. You'll need to make sure that
> when you open a new channel as part of the retry that you have moved
> work off the connection thread. Basically, you need to start a new
> thread in handleShutdownSignal before starting to interact with the
> connection.
>
> I think a better solution is to use a ShutdownListener that can be
> attached to either the channel or the connection (or both). This is
> slightly more robust because it will allow retry to happen if the
> consumer hasn't yet been created (maybe there is an intermittent failure
> during startup).
>
> Regards,
>
> Rob
More information about the rabbitmq-discuss
mailing list