春季集成汇总的消息两次

发布于 2025-02-09 22:26:26 字数 100 浏览 1 评论 0 原文

我有一个用例,我的消息被分配了两次,我想汇总所有这些消息。如何最好地实现这一目标,我应该通过引入不同的序列标头两次汇总消息,还是有没有办法通过覆盖方法将消息分组的方法分组方式来汇总消息?

I have a use case where my message are being split twice and i want to aggregate all these messages. How can this best be achieved, should i aggregate the messages twice by introducing different sequence headers, or is there a way to aggregate the messages in single aggregating step by overriding the method how messages are grouped?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

才能让你更想念 2025-02-16 22:26:26

这就是所谓的“嵌套分裂”,并且有内置的算法将序列细节标头推向堆栈以进行新的分裂上下文。这将允许最终具有上升聚合:第一个用于最接近嵌套分裂的聚合,弹出序列详细信息标头,并允许下一个聚合器处理其自己的序列上下文。

因此,用两个词说:最好在开始时发送一条消息并在最后接收一条消息,那么最好的聚合器是分裂的。

当然,您可以使用 applySequence = false 具有自定义分裂算法。尽可能多。最后只有一个聚合器,但已经具有自定义相关逻辑。

我们在文档中有一些解释:

从版本5.3开始,在处理消息组之后, atraventCorrelatingMessageHandler 执行 MessageBuilder.popsequecedEtails() Message> Message Heversers修改适当的分配器 - aggregator方案, 。

我们没有关于此问题的示例,但这是测试案例的配置: httpps://github.com/spring-proing-proing-proing-project-project-proignt-projects/spring-intement/spring-integratign/春季综合核/src/test/java/org/strprfamework/intempration/gentregator/contregator/scenarios/nestedaggregationTests-context.xml

That's called a "nested splitting" and there is built-in algorithm to push sequence detail headers to the stack for a new splitting context. This would allow in the end to have an ascendant aggregation: the first one aggregate for the closest nested splitting, pops sequence detail headers and allows the next aggregator to deal with its own sequence context.

So, in two words: it is better to have as many aggregator as you have splitting if you want to send a single message in the start and receive a single message in the end.

Of course you can have a custom splitting algorithm with an applySequence = false. As many as you need. And have only a single aggregator in the end, but with a custom correlation logic already.

We have some explanation in the docs: https://docs.spring.io/spring-integration/docs/current/reference/html/message-routing.html#aggregatingmessagehandler

Starting with version 5.3, after processing message group, an AbstractCorrelatingMessageHandler performs a MessageBuilder.popSequenceDetails() message headers modification for the proper splitter-aggregator scenario with several nested levels.

We don't have a sample on the matter, but here is a configuration for test case: https://github.com/spring-projects/spring-integration/blob/main/spring-integration-core/src/test/java/org/springframework/integration/aggregator/scenarios/NestedAggregationTests-context.xml

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文