You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "John D. Ament" <jo...@gmail.com> on 2014/05/01 23:06:00 UTC

Proper way to override DefaultShutdownStrategy

Hi all,

I was looking for a way to have a shutdown callback.  I overrode the
doShutdown method of DefaultShutdownStrategy, thinking it would be called
for shutdown of the camel context.  Turns out that it's being called as a
part of the shutdown for each route as well.

Is there a more appropriate way to shutdown, but only when the context is
being shutdown, rather than the routes?

I'm using Camel 2.10.6.

John

Re: Proper way to override DefaultShutdownStrategy

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

What do you want to do?

If you want to do execute some custom code when CamelContext is being
shutdown, then use event notifier, or the lifecycle strategy.

Some links
http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/EventNotifier.html
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/LifecycleStrategy.html
https://camel.apache.org/advanced-configuration-of-camelcontext-using-spring.html

See also camel in action book, page 403

On Thu, May 1, 2014 at 11:06 PM, John D. Ament <jo...@gmail.com> wrote:
> Hi all,
>
> I was looking for a way to have a shutdown callback.  I overrode the
> doShutdown method of DefaultShutdownStrategy, thinking it would be called
> for shutdown of the camel context.  Turns out that it's being called as a
> part of the shutdown for each route as well.
>
> Is there a more appropriate way to shutdown, but only when the context is
> being shutdown, rather than the routes?
>
> I'm using Camel 2.10.6.
>
> John



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/