Java 如何避免Springboot骆驼路线每天在特定时间因挂断信号而关闭

Java 如何避免Springboot骆驼路线每天在特定时间因挂断信号而关闭,java,spring,spring-boot,apache-camel,spring-camel,Java,Spring,Spring Boot,Apache Camel,Spring Camel,我有一个独立的springboot应用程序,带有ApacheCamel2.24 camelroutes设置。预计它将全天候运行应用程序,并且永不停机。通过驼峰REST DSL公开为REST API的服务 ** 请帮助避免camel springboot应用程序关闭,而不是关闭java进程 每天自动 ** 我已经从Udeploy执行了springbootjar,并使用nohupjava-jar命令进行部署,以避免挂断中断 每天在一天中的特定时间,应用程序都会收到一条用于挂起和停止主实例的Hangu

我有一个独立的springboot应用程序,带有ApacheCamel2.24 camelroutes设置。预计它将全天候运行应用程序,并且永不停机。通过驼峰REST DSL公开为REST API的服务

**

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

**

我已经从Udeploy执行了springbootjar,并使用nohupjava-jar命令进行部署,以避免挂断中断

每天在一天中的特定时间,应用程序都会收到一条用于挂起和停止主实例的HangupInterceptor消息。这将优雅地关闭我的Camel路由,关闭spring Camel上下文,并最终销毁camelhttptransport servlet

最后,当我检查ps-ef | grep java时,springboot应用程序的jvm java进程也被Camel上下文强制关闭/终止,不再运行

日志:

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

org.springframework.boot
spring启动web

HangupInterceptor
可以通过在应用程序.properties中设置
camel.main.HangupInterceptor enabled=false来禁用。

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

谁在发送挂断?并发布您的代码,而不仅仅是itI的一个片段。我无法跟踪它,因为日志没有显示它。我假设它可能来自执行java-jar命令的Udeploy服务器,也可能来自启动SIGHUP的Unix服务器jvm。从来没有听说过Udeploy,所以优秀的luckI拥有通常的springbootsapplication主类,scanBasePackages没有太多内容。我使用Apache Camel的依赖项Camel spring启动程序。它自动识别路线。路由在一个类中定义,该类使用@Component扩展routebuilder。你能告诉我你对哪段代码感兴趣吗?路由是如何定义的?UDeploy是UrbanCode部署的?这是camel 3.0.x的一部分吗?我现在在2.24上。我还没有迁移。你是对的,这是在3.0.0中引入的(对不起,我在看master branch)。目前,我看不到如何在2.24中设置这一点的简单方法。迁移到3.x是个好主意,因为2.24.x将不再更新(2.24.3是上次计划的补丁),2.25.x计划只支持到今年年底。