[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recommendation/Best Practice for shutting down Camel Spring Boot App

Hi Jonathan,

On Wed, Apr 4, 2018 at 10:20 PM, Jonathan Cook
<jonathan.cook@xxxxxxxxxxxxxx> wrote:
> But it isn't clear, do I have to create some kind of custom shutdown hook
> which I can call externally and stop the camel context or shut the routes
> down gracefully or does something in Camel Spring Boot do this for me?

When auto-configured under Spring Boot, or manually configured using
SpringCamelContext, Camel's context startup/shutdown is tied to Spring
context startup/shutdown.

> To shut it down I was thinking of another shell script but don't simply want
> to kill the process. I've see Spring Boot Actuator provides a way via http
> but my app is not a webapp in a fat jar, just a standalone java app. I've
> also seen Spring Boot has a ApplicationPidFileWriter which writes the pid to
> a file but again this approach uses a brute force kill.

I think you should be able just to use `kill` without specifying
signal (that is SIGTERM or -15), or `kill -2` to use SIGINT signal,
equivalent of sending CTRL+C.

Zoran Regvart