我必须在 route 运行一个循环。我的路线看起来像
<camel:loop>
<camel:constant>${property.x}</camel:constant>
</camel:loop>
我的处理器看起来像
Date date = new Date();
this.LOGGER
.info("\n****WELCOME TO THE REQUEST OF CHECK PROCESSOR**");
int y=4;
Integer a=new Integer(y);
exchange.setProperty(x,a);
int k=(Integer) exchange.getProperty(x);
this.LOGGER
.info("\n***WELCOME TO THE REQUEST OF CHECK PROCESSOR ENDINGGGGGGGG***"+"a= "+a+" Y= "+y+" x= "+exchange.getProperty(x)+" k= "+k);
运行时x的值= 4。我想在camel路由XML文件中访问这个x。
最佳答案
您必须使用simple语言而不是constant,正确的语法是${properties:x}
关于java - 如何在 Camel 路由 XML 中检索交换属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41712421/