Apache camel 从驼峰路线重新加载属性而不停止它
Apache camel 从驼峰路线重新加载属性而不停止它,apache-camel,Apache Camel,我正试图找到一种方法来动态更新属性(从PropertyComponent),而不停止骆驼路线: 下面是一个例子: @Override public void configure() throws Exception { CamelContext ctx = super.getContext(); PropertiesComponent pc = new PropertiesComponent(); pc.setLocation("/tmp/apac
我正试图找到一种方法来动态更新属性(从PropertyComponent),而不停止骆驼路线: 下面是一个例子:
@Override
public void configure() throws Exception {
CamelContext ctx = super.getContext();
PropertiesComponent pc = new PropertiesComponent();
pc.setLocation("/tmp/apache-deltaspike.properties");
ctx.addComponent("properties", pc);
// Logs Hello World every 2000 milliseconds
from("timer://myEapTimer?fixedRate=true&period=2000")
.log(LoggingLevel.INFO, "com.sample.route", "{{customProperty}}")
.to("log:HelloWorldLog?level=INFO");
}
外部属性文件包含每次计时器触发时要打印的消息。我需要找到一种方法,让路由在不停止的情况下重新加载属性文件。
顺便说一句,我使用的是ApacheCamel 2.17.0。
感谢这是不可能的,
{{xxx}
仅在路由启动时解析一次
您可以使用JavaBean,在这里您可以自己加载属性文件,获取值并在那里进行日志记录
或者,您可以使用bean参数绑定调用Javabean,并注入属性值。但是您还需要将属性组件配置为不使用缓存等。谢谢您的帮助!