如果表达式值与任何映射都不匹配,我想使用 Spring Integration 来实现使用默认输出通道的基于内容的路由器。这是我的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" />
但是,似乎从未使用过默认输出通道。如果表达式计算结果为“baz”,则路由器似乎正在寻找名为“baz”的频道,而不是路由到“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 命名空间是我想要的,还是我需要编写自己的实现?