Apache camel 如何将多个修改过的消息发送到camel中的一个端点?

Apache camel 如何将多个修改过的消息发送到camel中的一个端点?,apache-camel,Apache Camel,在我的应用程序中,我根据给定的数据结构查询服务中的一些标识号。对于每个返回的标识号,我希望根据包含标识号的查询数据向同一收件人发送邮件消息: from("direct:querySource") .enrich("direct:executeQueryIds", new IdWithDataAggregator()) // here I stuck - want to send the original received message from // the querySource n (e

在我的应用程序中,我根据给定的数据结构查询服务中的一些标识号。对于每个返回的标识号,我希望根据包含标识号的查询数据向同一收件人发送邮件消息:

from("direct:querySource")
.enrich("direct:executeQueryIds", new IdWithDataAggregator())
// here I stuck - want to send the original received message from 
// the querySource n (executeQueryIds) times enrich by iterating
// over executeQueryIds result
.to("smtp://...")
.end()
我尝试根据某个消息头使用
split
拆分消息,但在拆分中,我只获得拆分的头值作为正文,而不是原始消息。使用带有聚合器的
split
调用作为第二个参数都不起作用,因为第二个交换是
null

我还尝试了
循环
结构,但我觉得应该有一种更方便、更自动化的方法


提前谢谢

如果要将一条消息转换为多条消息,仍然需要使用拆分器。您可能希望执行以下操作:

from(START)
 .split(). method(SplitBean.class, "splitMessage")
 .to(FINISH);

您可以将标题传递到bean方法中,并以这种方式手动拆分消息。

谢谢,这非常有效-我相信我现在已经有了这个想法。用适当的处理程序、标题和正文注释注释了我的拆分方法。