简体   繁体   English

从Apache Camel split中获取拆分消息

[英]Getting split message from Apache Camel split

I have following camel configuration for split xml using a xpath. 我有以下使用xpath为骆驼配置的骆驼配置。

from("direct:[nameofthetemplate]")
.split(xpath(xPath))
.end();

I need to get the items return from split and store them in an array list.How can I do that? 我需要将拆分后的项目返回并存储在数组列表中,该怎么办?

So you want aggregate them http://camel.apache.org/aggregator.html . 因此,您希望将它们汇总到http://camel.apache.org/aggregator.html

from("direct:[nameofthetemplate]")
.split(xpath(xPath)).aggregate()
.end();

But this is not create a java array list with xml node inside, just an XML composed of the nodes you split (it could be the initial message if it is initialy composed only of nodes you split). 但这不是在内部带有xml节点的Java数组列表中创建,而只是由您拆分的节点组成的XML(如果最初仅由您拆分的节点组成,则可能是初始消息)。 If you need to process xml node just continue your camel route to processing one by one after split. 如果您需要处理xml节点,则只需继续执行骆驼路线,即可在拆分后一一处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM