gpt4 book ai didi

java - 如何在 Camel 路由 XML 中检索交换属性?

转载 作者:行者123 更新时间:2023-12-01 09:00:30 24 4
gpt4 key购买 nike

我必须在 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com