8
我想使用Spring集成来实现基于内容的路由器,如果表达式值与任何映射都不匹配,则使用默认输出通道。这里是我的bean定义:春季集成:基于内容的路由器默认输出通道?
<int:router input-channel="channel_in" default-output-channel="channel_default" expression="payload.name">
<int:mapping value="foo" channel="channel_one" />
<int:mapping value="bar" channel="channel_two" />
然而,似乎默认的输出通道从未使用过。如果表达式评估为例如“巴兹”,路由器似乎在寻找,而不是路由到“channel_default”频道名为“巴兹”通道:
org.springframework.integration.MessagingException: failed to resolve channel name 'baz'
Caused by: org.springframework.integration.support.channel.ChannelResolutionException:
failed to look up MessageChannel bean with name 'baz'
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No bean named 'baz' is defined
是我想在所有可能使用XML命名空间,还是我需要编写我自己的实现?
如果您正在阅读Spring Integration 2.1+,忽略了通道名称解析失败。您可以通过使用resolution-required =“false”来获得相同的效果。请参阅http://static.springsource.org/spring-integration/reference/htmlsingle/#2.1-router-standardization – Joe