首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何避免Springboot Camel路由每天因特定时间挂起信号而关闭

如何避免Springboot Camel路由每天因特定时间挂起信号而关闭
EN

Stack Overflow用户
提问于 2020-01-24 17:36:53
回答 2查看 1.5K关注 0票数 0

我有一个带有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。

日志:

代码语言:javascript
复制
[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文件--这包括

代码语言:javascript
复制
camel.springboot.main-run-controller=true

pom.xml文件--包括

代码语言:javascript
复制
<dependency>   
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-started-web</artifactId>
</dependency>
EN

回答 2

Stack Overflow用户

发布于 2020-01-26 16:36:23

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

票数 0
EN

Stack Overflow用户

发布于 2020-09-16 02:18:34

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59901255

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档