我有一个带有Apache 2.24骆驼路径设置的独立的springboot引导应用程序。预计它将运行应用程序24x7,并且永不停机。这些服务通过camel REST DSL作为REST公开。
**
请帮助避免camel shutting引导应用程序关闭,而不是每天自动关闭java进程。
**
为了避免挂起中断,我使用nohup -jar命令执行了Udeploy中的springboot jar。
每天,应用程序在特定的时间接收一条用于挂起和停止主实例的HangupInterceptor消息。它优雅地关闭了我的骆驼路线,关闭了spring骆驼上下文,并最终破坏了camelhttptransport。
最终,springboot引导应用程序的jvm java进程也会被Camel上下文强制关闭/终止,并且当我检查ps -ef \ grep java时不再运行-ef。
日志:
[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=truepom.xml文件--包括
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-started-web</artifactId>
</dependency>发布于 2020-01-26 16:36:23
可以通过在HangupInterceptor中设置camel.main.hangup-interceptor-enabled=false来禁用application.properties。
发布于 2020-09-16 02:18:34
还发现其他一些应用程序sh脚本在所有java上运行了一个杀害-9命令来停止应用程序。找到了它并修复了脚本,以避免杀死springboot应用程序。
https://stackoverflow.com/questions/59901255
复制相似问题