[英]Spring Integration migration issue
I have this kind of chains at different places in my application: 我在应用程序的不同位置都有这种链条:
<int:chain input-channel="updateAdministratorChannel">
<int:filter expression="payload.isAdministatorPublished"/>
<int:service-activator expression="..."/>
<int:gateway request-channel="mergeEntityChannel"/>
<int:logging-channel-adapter logger-name="..." expression="'...'"/>
</int:chain>
Everything was working fine with Spring Integration version 3.0.1.RELEASE. Spring Integration 3.0.1.RELEASE版本一切正常。 We decided to migrate to version 4.2.x and we have an issue with the filter : when the condition is false the system hangs (until it timeout i suppose).
我们决定迁移到4.2.x版本,并且过滤器出现问题:当条件为false时,系统挂起(直到我认为超时)。 In the end i had to add a discard channel and modify my chains like so:
最后,我不得不添加一个废弃通道并像这样修改我的链:
<int:chain input-channel="updateAdministratorChannel">
<int:filter expression="payload.isAdministatorPublished" discard-channel="defaultDiscardChannel"/>
<int:service-activator expression="..."/>
<int:gateway request-channel="mergeEntityChannel"/>
<int:logging-channel-adapter logger-name="..." expression="'...'"/>
</int:chain>
<int:header-value-router input-channel="defaultDiscardChannel" header-name="replyChannel"/>
I've read the Migration Guides but i don't see anything about that. 我已经阅读了《 迁移指南》,但对此一无所获。 Did i miss something ?
我错过了什么 ?
Spring version : 4.2.5.RELEASE
Spring Integration version : 4.2.6.RELEASE
Your concern isn't clear because the behavior is expected: when filter
is used by default, a discarded message is just dropped. 您的担忧尚不清楚,因为这是预期的行为:默认情况下使用
filter
时,只会丢弃丢弃的消息。
Not sure what behavior you are expecting or what you are claiming is working in version 3.0.x
, but what I guess by your config that you have a messaging gateway in the beginning you expect some reply from your <chain>
. 不确定您期望的行为或所声称的行为在
3.0.x
版中是否有效,但是不确定您的配置是否在一开始就具有消息传递网关,您期望您会收到<chain>
答复。 Of course this is not possible when you do nothing on the filter level. 当然,当您在过滤器级别不执行任何操作时,这是不可能的。
What you do with the discard-channel
is the correct solution. 使用
discard-channel
是正确的解决方案。
Another option would be possible with the throw-exception-on-rejection="true"
and an error-channel
on the <gateway>
to catch those discarded messages there and resend as a reply. 另一种选择是可能的,
throw-exception-on-rejection="true"
和<gateway>
上的error-channel
,可以在那里捕获那些丢弃的消息并重新发送作为回复。
Note: Spring Integration 4.2
is out of support already. 注意:Spring Integration
4.2
已经不支持。 It is recommended to upgrade at least to the 4.3.x
if can't to 5.0.x
: https://spring.io/projects/spring-integration#learn 如果无法升级到
5.0.x
建议至少升级到4.3.x
: https : 4.3.x
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.