How to retrieve a exchange property in the camel route XML?

点点圈 提交于 2020-01-06 16:22:47

问题


I have to run a loop in the route. my route looks as

<camel:loop>
      <camel:constant>${property.x}</camel:constant> 
</camel:loop>

My processor looks as

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);

while running this the value of x= 4.I want to access this x in the camel route XML file.


回答1:


A good idea is to spend a bit time on the Camel website to find what you ask. See the exchangeProperty: http://camel.apache.org/exchangeproperty.html



来源:https://stackoverflow.com/questions/41712421/how-to-retrieve-a-exchange-property-in-the-camel-route-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!