首页 > 解决方案 > 带有外部调度程序的 Camel Spring Boot

问题描述

我们需要在 Camel Spring Boot 中使用第三方调度器。我们可以构建 Spring Boot Jar 并将命令提供给外部调度程序以调用:

java -jar app-name.jar

问题是,一旦处理完成,我们将永远不知道何时将控制权返回给外部调度程序(它不应该在两者之间停止,但只要完成处理就应该保持活动状态)。

在 Camel Spring Boot 中,我们使用以下属性来保持路由线程处于活动状态:

camel.springboot.main-run-controller=true

如果我们将上述属性设为 false,Camel 甚至会在处理完成之前关闭。如果这是真的,Camel 将无限期地保持活动状态,并且一旦完成,调度程序将无法关闭 Camel 进程。

感谢您对此的任何帮助。

标签: spring-bootapache-camelspring-camel

解决方案


我认为您正在寻找的是在处理完一条消息后关闭您的 Spring Boot 应用程序。尝试这个

camel.springboot.main-run-controller=true
camel.springboot.duration-max-messages=1

或者

camel.springboot.main-run-controller=true
camel.springboot.duration-max-idle-seconds=30

推荐阅读