我是Spring Integration的新手,我们创建了一个SI流,其中我们的分离器和聚合器还收件列表曲线和聚合器。今天,在检查代码时,如果我们在流程之间有例外,我对聚合器将如何清洁其商店感到困惑。我担心我们在流动之间得到例外的情况,并在系统中创建陈旧的状态对象。我已经检查了春季集成文档,但没有运气(https://docs.spring.io/spring-integration/docs/2.0.0.rc1/reference/html/aggregator.html)。我只能看到一个主题"在聚合器中管理状态:MessageGroupStore",但这是用于"应用程序射击"。
另外,我也做了Google,发现一个线程https://dzone.com/articles/spring-integration-robust,但不能太多。当然,如果我能找到一些解决方案,我会回来。
我使用的是OOB分离器,收件人列表 - 路由器和聚合器。考虑模式应具有这种常见情况。
你能指导我
即:
<int:recipient-list-router input-channel="inputChannel"
default-output-channel="nullChannel">
<int:recipient channel="aInputChannel" />
<int:recipient channel="bInputChannel" />
</int:recipient-list-router>
<int:service-activator ref="aHandler"
input-channel="aInputChannel" output-channel="aggregatorOutputChannel" />
<!-- we have exception in the bHandler -->
<int:service-activator ref="bHandler"
input-channel="bInputChannel" output-channel="aggregatorOutputChannel" />
<int:aggregator input-channel="aggregatorOutputChannel"
output-channel="outputChannel" />
或
<int-file:splitter id="splitile"
charset="UTF-8" apply-sequence="true" iterator="false"
input-channel="inputChannel"
output-channel="bTransformerChannel" />
<!-- consider we have exception at 4th chunk -->
<int:service-activator ref="transform"
input-channel="bTransformerChannel" output-channel="aggregatorOutputChannel" />
<int:aggregator input-channel="aggregatorOutputChannel"
output-channel="outputChannel" />
是;默认情况下,聚合是一个"被动"组件 - 消息到达时均采取所有操作。
为了超时陈旧组,您可以使用收割机,或者使用更近期的版本group-timeout
。