在我的应用程序中,我尝试根据服务方法返回的http状态值进行路由,其余的http状态将被路由到默认错误通道。但是这个默认Map不起作用,
@Bean
public IntegrationFlow bridgeFlow() {
return IntegrationFlows.from(ApplicationConfiguration.QUEUE_CHANNEL)
.bridge(e -> e.poller(Pollers.fixedDelay(2500).maxMessagesPerPoll(MAX_MSG_PER_POLL)))
.handle(someService, "someMethod")
.route(router())
.get();
}
public ExpressionEvaluatingRouter router() {
ExpressionEvaluatingRouter router = new ExpressionEvaluatingRouter("headers['httpStatus']");
router.setChannelMapping("422", REJECTED_QUEUE_CHANNEL);
router.setChannelMapping("202", "nullChannel");
router.setChannelMapping("201", "nullChannel");
router.setDefaultOutputChannelName(ORR_FAILED_QUEUE_CHANNEL);// When I receive other status codes it should go into this channel. But it's not going and throwing a runtime exception when a status code other than these is received.
return router;
}
我尝试将默认通道放在.route(router()).channel(orr\u failed\u queue\u channel)和.route(router()).handle(orr\u failed\u queue\u channel)之后。但是它在bean初始化过程中失败了,说“currentcomponent”(org.springframework.integration.router)。expressionevaluatingrouter@1ca574db)是单向“messagehandler”,不适合配置“outputchannel”。这是集成流的结束。
1条答案
按热度按时间xggvc2p61#
无法将此选项设置为
false
在路由器上:关于这件事有一份文件:https://docs.spring.io/spring-integration/docs/current/reference/html/message-routing.html#router-常用参数