Shutdown sequence when running Camel in Springboot

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Shutdown sequence when running Camel in Springboot

raffi
With respect to graceful shutdown, does Springboot hook into Camel such that invoking Springboot's standard "/shutdown" endpoint automatically shuts down Camel first, then the JVM?

Trying to understand if explicit shutdown hooks are requried.

Best
Raffi
Reply | Threaded
Open this post in threaded view
|

Re: Shutdown sequence when running Camel in Springboot

hekonsek
Yes. CamelContext is wired as a Spring bean with registered shutdown
method, so calling Spring's shutdown will close CamelContext in the first
place before closing Spring context.

Cheers!

czw., 10.12.2015 o 20:25 użytkownik raffi <[hidden email]> napisał:

> With respect to graceful shutdown, does Springboot hook into Camel such
> that
> invoking Springboot's standard "/shutdown" endpoint automatically shuts
> down
> Camel first, then the JVM?
>
> Trying to understand if explicit shutdown hooks are requried.
>
> Best
> Raffi
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Shutdown-sequence-when-running-Camel-in-Springboot-tp5774960.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Henryk Konsek
http://about.me/hekonsek
Reply | Threaded
Open this post in threaded view
|

Re: Shutdown sequence when running Camel in Springboot

raffi
Yeah, I see that working now, just POST to "/shutdown" and springboot shuts everything down, including Camel.

The problem with SB's shutdown endpoint is, although it stops Camel first, then the JVM, the initial request to `/shutdown` returns immediately, but the time between the request and when the JVM terminates can take up to 60s, sometimes more, and that's a problem for our deployment scripts. But if I shutdown Camel from JMX, then shutdown SB from "/shutdown", it's much more predictable.

I want to override Springboot's shutdown process with custom code to shutdown Camel manually from JMX. Doing so blocks until Camel is shutdown, and that's what I'm after, except I can't figure out how to override Springboot's shutdown sequence.  
Reply | Threaded
Open this post in threaded view
|

Re: Shutdown sequence when running Camel in Springboot

raffi