Spring集成MessageGroupStoreReaper全局errorChannel



我正在使用spring集成聚合器和messagegroupstoreaper,但不知怎的错误没有达到全局errorChannel。

<int:aggregator id="agg"
ref="MyMsgsAggregator"
input-channel="myAggInputChannel"
output-channel="processInputChannel"
discard-channel="errorChannel"
method="aggMessages"
message-store="messageGroupStore"
send-partial-result-on-expiry="true"
expire-groups-upon-completion="true" />

<bean id="messageGroupStore" class="org.springframework.integration.store.SimpleMessageStore" />
<task:scheduled-tasks>
<task:scheduled ref="multipartAggregatorReaper" method="run" fixed-rate="5000" />
</task:scheduled-tasks>

如果有任何异常post "processInputChannel"(例如,部分结果过期)则异常没有到达全局"errorChannel"。

甚至我尝试用轮询器将任务调度的作业替换为入站通道适配器(如@Gary建议的),但仍然不起作用:

<int:inbound-channel-adapter channel="reaperChannel" ref="MyMsgsAggregator" method="triggerReaper"> 
<int:poller error-channel="**errorChannel**" fixed-rate="5000">         
</int:poller>

& lt;/int: inbound-channel-adapter>

请建议

感谢

您的问题在这里:send-partial-result-on-expiry="true"。此选项确实与discard-channel:

互斥。
protected void expireGroup(Object correlationKey, MessageGroup group, Lock lock) {
...
if (this.sendPartialResultOnExpiry) {
...
completeGroup(correlationKey, group, lock);
}
else {
...
group.getMessages()
.forEach(this::discardMessage);
}
...
}

所以,这并不奇怪,你的消息在收获后去processInputChannel,而不是errorChannel

同样,discardChannel不是关于错误的。当我们收获并且没有从那里发送ErrorMessage时,在丢弃的情况下不会抛出异常。来自已获取组的所有单个消息都作为常规消息发送到配置的discardChannel

最新更新