我想遍历通过bean作为消息头传递给camel路由的java arraylist,这样每个基本上是url的字符串项都可以作为uri参数传递给camel路由中的标记。
我通过java bean将数组列表作为消息头传递给camel路由,如下所示
ArrayList<String> list=new ArrayList<String>();//Creating arraylist
list.add("http://www.google.com");//Adding object in arraylist
list.add("http://www.stackoverflow.com");
list.add("http://www.tutorialspoint.com");
list.add("http://localhost:8080/sampleExample/query");
exchange.getOut().setHeader("endpoints",list);
<route id="myroute">
<from id="sedp" uri="cxfrs:http://{{env:POC_HOST}}/{{env:POC_PATH}}"/>
<log id="_log1" message="Received query request from consumers"/>
<bean beanType="com.company.myapp.poc.logic.ProcessRequest"
id="queryProcessor" method="checkRequestType"/>
// I want to iterate through the list here as <toD uri="${header.endpoints.item}" />
</route>
但我无法遍历列表中作为标题接收的每个项目。驼峰路线内的端点。