如何将headervaluerouter链接到输入通道?

时间:2016-10-28 02:08:09

标签: spring spring-integration integration

我创建了一个headervaluerouter bean

@Bean
public HeaderValueRouter router (){
    HeaderValueRouter router = new HeaderValueRouter("received");
    router.setChannelMapping("response","replyCh");
    router.setChannelMapping("request","requestCh");
    //router.setManagedName();
    return router;
}

但路由器无法设置输入通道?

1 个答案:

答案 0 :(得分:1)

路由器是MessageHandler实现。它的责任就是处理信息。输入通道是消费者端点逻辑的一部分。为此,您可以使用@ServiceActivator@Router标记此路由器bean。您可以在参考手册中找到更多信息:http://docs.spring.io/spring-integration/docs/4.3.4.RELEASE/reference/html/overview.html#programming-tips