在我的应用程序中,我根据给定的数据结构查询某些标识号的服务 . 对于每个返回的标识号,我想基于具有标识号的查询数据向同一收件人发送邮件消息:
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
.
我也尝试了 loop
构造,但我觉得应该有一种更方便,更自觉的方法 .
提前致谢!
1 回答
如果您想将单个邮件转换为多条邮件,您仍然希望使用拆分器 . 你可能想要做这样的事情:
您可以将标头传入bean方法并手动拆分消息 .