如何避免springboot Camel 路线每天在特定时间因挂断信号而关闭

0ejtzxu1  于 2021-06-30  发布在  Java
关注(0)|答案(2)|浏览(345)

我有一个独立的springboot应用程序,安装了apachecamel2.24 camelroutes。预计它将全天候运行应用程序,而且永远不会停机。通过camel rest dsl公开为restapi的服务。

**

请帮助您避免camel springboot应用程序每天自动关闭而不是关闭java进程

**

我使用nohupjava-jar命令从udeploy执行了springbootjar,以避免挂断中断。
每天的特定时间,应用程序都会收到一条hangupinterceptor消息,用于挂断和停止主示例。这将优雅地关闭我的camel路由,关闭spring camel上下文,并最终销毁camelhttptransport servlet。
最后,当我检查ps-ef | grep java时,camel上下文也会强制关闭/终止springboot应用程序的jvmjava进程,并且不再运行
日志:

[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文件

camel.springboot.main-run-controller=true

包含pom.xml文件

<dependency>   
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-started-web</artifactId>
</dependency>
uqzxnwby

uqzxnwby1#

HangupInterceptor 可通过设置禁用 camel.main.hangup-interceptor-enabled=false 在application.properties中。

ej83mcc0

ej83mcc02#

发现其他一些应用程序sh脚本在所有java PID上运行kill-9命令来停止应用程序。找到它并修复了脚本以避免杀死springboot应用程序

相关问题