【问题标题】:Spring Integration: @ServiceActivator is not workingSpring 集成:@ServiceActivator 不起作用
【发布时间】:2016-07-15 13:18:56
【问题描述】:

我有以下课程:

@Configuration
public class SpringIntegrationTest {

    @Bean
    public SimpleWebServiceInboundGateway testInboundGateWay (){
        SimpleWebServiceInboundGateway simpleWebServiceInboundGateway = new SimpleWebServiceInboundGateway();
        simpleWebServiceInboundGateway.setRequestChannelName("testChannel");
        simpleWebServiceInboundGateway.setReplyChannelName("testChannel2");
        return simpleWebServiceInboundGateway;
    }

    @Bean
    public MessageChannel testChannel() {
        return new DirectChannel();
    }

    @Bean
    public MessageChannel testChannel2() {
        return new DirectChannel();
    }

    @ServiceActivator(inputChannel = "testChannel", outputChannel = "testChannel2")
    public DOMSource foo(DOMSource request) {
        System.out.println("asd");
        return request;
    }

    @Bean
    public EndpointMapping soapActionEndpointMapping(SimpleWebServiceInboundGateway testInboundGateWay ) {
        UriEndpointMapping uriEndpointMapping = new UriEndpointMapping();
        uriEndpointMapping.setUsePath(true);
        uriEndpointMapping.setEndpointMap(createEndpointMapping(testInboundGateWay ));
        return uriEndpointMapping;
    }

    private Map<String, Object> createEndpointMapping(SimpleWebServiceInboundGateway testInboundGateWay ) {
        Map<String, Object> endpointMap = new HashMap<>();
        endpointMap.put("/ws/test", testInboundGateWay );
        return endpointMap;
    }

}

即使服务激活器订阅了“testChannel”,我也会收到以下消息:

o.s.i.w.SimpleWebServiceInboundGateway - 网关 sendAndReceive 发生故障:调度程序没有频道“org.springframework.web.context.WebApplicationContext:/MyProject restful API.testChannel”的订阅者。嵌套异常是 org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers

我做错了什么?

【问题讨论】:

    标签: java spring spring-integration


    【解决方案1】:

    您需要将@EnableIntegration 添加到您的配置类之一。

    【讨论】:

      【解决方案2】:

      向 testChannel 添加调度程序将解决此问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-01-08
        • 1970-01-01
        • 2012-12-29
        • 2014-02-11
        • 1970-01-01
        相关资源
        最近更新 更多