Spring集成收件人列表路由器问题
我在应用程序中使用收件人列表路由器将消息发送到不同的JMS出站适配器,如下所示:Spring集成收件人列表路由器问题,spring,spring-integration,spring-jms,jms-topic,jmstemplate,Spring,Spring Integration,Spring Jms,Jms Topic,Jmstemplate,我在应用程序中使用收件人列表路由器将消息发送到不同的JMS出站适配器,如下所示: queue -> recipient-list-router -> queue1 -> JMS outbound adapter 1 -> queue2 -> JMS outbound adapter 2 我面临两个问题: 选择器表达式仅在最初运行,而不是针对每个转发的消息运行 若任何JMS代理关闭,则消息不会被发送到
queue -> recipient-list-router -> queue1 -> JMS outbound adapter 1
-> queue2 -> JMS outbound adapter 2
我面临两个问题:
<i:recipient-list-router input-channel="result-pack-output-channel" >
<i:recipient channel="result-pack-output-channel-1"
selector-expression="#{utils.isHourInInterval('LN')}"/>
<i:recipient channel="result-pack-output-channel-2"
selector-expression="#{utils.isHourInInterval('NY')}"/>
<i:recipient channel="result-pack-output-channel-3"
selector-expression="#{utils.isHourInInterval('HK')}" />
<i:recipient channel="result-pack-output-channel-4"
selector-expression="#{utils.isHourInInterval('ME')}"/>
</i:recipient-list-router>
#{…}
表达式在上下文初始化期间计算一次。这里,您需要运行时表达式。在运行时表达式中,使用@
-引用其他bean-因此
selector-expression="@utils.isHourInInterval('LN')"
编辑
我错过了你的第二个问题-使用
ignore send failures=“true”>
请向我们展示一些java代码或实现的XML配置。否则很难帮助你。另外,您是否看到任何异常?@Tobias:添加了xml配置无异常@Tobias请同时提及AbstractMessageRouter.ignoreSendFailures
。(我在吉特呆了太久,所以失去了回答的机会;-)谢谢@Gary Russell。我做了更改,但不确定表达式是否有效。尝试在bean中放置日志行,但未打印。详细检查后将更新。@ArtemBilan感谢您的努力:)