【发布时间】:2014-12-24 08:44:37
【问题描述】:
我在回复通道上有 http 状态码的标头值路由器。如果状态代码为200,我想将原始有效负载重定向到afterSuccessChannel,否则如果标头中有任何其他状态,我想将有效负载发送到afterFailuerChannel。我不确定header-value-router 是否可行,因为没有表达式字段。 header-value-router 是否有可能,或者我必须为此使用通用路由器?
<int:header-value-router header-name="#{T(org.springframework.integration.http.HttpHeaders).STATUS_CODE}" input-channel="ccChannel" default-output-channel="ccLogger">
<int:mapping value="200" channel="afterSuccessChannel"/>
</int:header-value-router>
即使我在消息的标题上得到http_statusCode=200,在使用上述路由器时也会出现以下错误:
ErrorMessage [payload=org.springframework.messaging.MessagingException: failed to resolve channel name 'OK'; nested exception is org.springframework.messaging.core.DestinationResolutionException: failed to look up MessageChannel with name 'OK' in the BeanFactory.; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'OK' is defined, headers={timestamp=1419419964606, id=eea83b65-0e72-bcda-d8fe-6d9bb4619fb4, history=errorChannel}]
不知道为什么要找OK频道。
【问题讨论】:
标签: java spring spring-integration