我有一个场景,其中一条消息可以生成多条消息,独立于原始消息进行处理。
我尝试过拆分器EIP,但看起来它有一个默认的聚合策略(我似乎无法关闭)。
我可以实现这条路线:
from("direct:in").to("bean:multipleMsgGenerator").to("direct:out")multipleMsgGenerator可以将n个独立消息发送到“direct:out”?
谢谢!
I've got a scenario where one message can generate multiple messages to be processed independently of the original.
I have tried the splitter EIP but it looks like it has a default aggregation strategy (which I can't seem to be able to turn off).
Can I achieve this route:
from("direct:in").to("bean:multipleMsgGenerator").to("direct:out")where multipleMsgGenerator can send n number of independent messages to "direct:out" ?
Thanks!
最满意答案
默认情况下,拆分器返回原始消息(camel_version> = 2.3)。 请参阅http://camel.apache.org/splitter.html 。 也就是说,您可以对溢出块内的各个拆分消息执行任何操作。
例如,如果消息正文是List,则可以执行以下操作:
from ("direct:in) .split(body()) .to("direct:processIndividualMsg") .end() .to("direct:doSomethingWithTheOriginalMsg");The splitter by default returns the original message (camel_version >= 2.3). See http://camel.apache.org/splitter.html. That said you can do whatever you want to do with the individual splitted messages inside the spilt block.
If the body of the message is a List for instance you can do this:
from ("direct:in) .split(body()) .to("direct:processIndividualMsg") .end() .to("direct:doSomethingWithTheOriginalMsg");更多推荐
发布评论