生成多条消息(Generate multiple messages)

编程入门 行业动态 更新时间:2024-10-09 16:23:58
生成多条消息(Generate multiple messages)

我有一个场景,其中一条消息可以生成多条消息,独立于原始消息进行处理。

我尝试过拆分器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");

更多推荐

本文发布于:2023-08-07 12:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464158.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多条   消息   Generate   multiple   messages

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!