0
votes

I have a stand-alone springboot application with Apache Camel 2.24 camelroutes setup. It is expected to run the application 24x7 and never go down. The services exposed as REST API through camel REST DSL.

**

Please help how to avoid the camel springboot application from shutting down and not shut down the java process automatically every day

**

I have executed the springboot jar from Udeploy with a nohup java -jar command to deploy to avoid hang ups interruption.

Every day at specific time of day the application receives a HangupInterceptor message for Hang up and stopping the main instance. This Shuts down my Camel routes gracefully, shuts down spring camel context and finally destroys the camelhttptransport servlet.

Eventually the springboot application’s jvm java process is also forcefully shutdown/terminated by the Camel context and no longer running when I check with ps -ef | grep java

Logs:

[ngupInterceptor] o.a.c.m.MainSupport$HangupInterceptor : Received hang up - stopping the main instance.
[ngupInterceptor] o.a.camel.spring.SpringCamelContext : Apache Camel 2.24.0 (CamelContext: Camel1) is shutting down
[ngupInterceptor] o.a.camel.impl.DefaultShutdownStrategy : Starting to graceful shutdown 2 routes(timeout 300 seconds)
[ - ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy : Route: routename1 shutdown complete, was consuming from: direct://r1
[ - ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy : Route: routename2 shutdown complete, was consuming from: direct://r2
[ngupInterceptor] o.a.camel.impl.DefaultShutdownStrategy : Graceful shutdown of 2 routes completed in 0 seconds
[ Thread-7] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService ’applicationTaskExecutor’
[ngupInterceptor] o.a.camel.main.MainLifecycleStrategy : CamelContext: Camel1 has been shutdown, triggering shutdown of the JVM
[ngupInterceptor] o.a.camel.spring.SpringCamelContext : Apache Camel 2.24.0 (CamelContext: Camel1) uptime 6 hours 10 minutes
[ngupInterceptor] o.a.camel.spring.SpringCamelContext : Apache Camel 2.24.0 (CamelContext: Camel1) is shutdown in 0.052 seconds
[ Thread-7] o.a.c.c.s.CamelHttpTransportServlet : Destroyed CamelHttpTransportServlet[Servlet]

application.properties file this is included

camel.springboot.main-run-controller=true

pom.xml file this is included

<dependency>   
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-started-web</artifactId>
</dependency>
2
who is sending the hangup? and post your code, not just a snippet of itToerktumlare
I’m unable to track it as the logs don’t show it. I assume it could be from the Udeploy server which executed the java -jar command or from the Unix server jvm which initiated a SIGHUP.Sunil_RedDevil
never heard of uDeploy, so good luckToerktumlare
I have the usual springbootApplicatio main class which scanBasePackages nothing much there. I use the Apache Camel’s dependency <artifactId>camel-spring-boot-starter</artifactId>. It auto identifies the routes. The routes are defined in a class which extends routebuilder with @Component. Could you let me know which piece of code would you be interested to look at ? How the routes are defined?Sunil_RedDevil
UDeploy is UrbanCode DeploySunil_RedDevil

2 Answers

0
votes

HangupInterceptor can be disabled with setting camel.main.hangup-interceptor-enabled=false in your application.properties.

0
votes

It was found some other applications sh script ran a kill -9 command on all java pids to stop application. Found it and fixed the script to avoid killing the springboot app