Spring integration 实现网关导致消息流中出现问题

Spring integration 实现网关导致消息流中出现问题,spring-integration,Spring Integration,我有一个场景,在这个场景中,我正在接收一条消息,并使用收件人列表路由器将其路由到不同的消息通道 <int:recipient-list-router input-channel="inputChannel1" apply-sequence="true" id="router1"> <int:recipient channel="service1" /> <int:recipient channel="service2" /> </i

我有一个场景,在这个场景中,我正在接收一条消息,并使用收件人列表路由器将其路由到不同的消息通道

<int:recipient-list-router input-channel="inputChannel1" 
    apply-sequence="true"   id="router1">
  <int:recipient channel="service1" />
  <int:recipient channel="service2" />
</int:recipient-list-router>


此聚合器用于聚合来自上述2个服务的响应,并将聚合的输出重定向到其他通道以进行进一步处理

<int:aggregator input-channel="aggregator1" output-channel="channel2" >
    <bean class="wsintg.service.AggregatorClass" /> 
</int:aggregator>


单个服务的代码如下所示:

 <!--service 1 code -->

<int:service-activator input-channel="service1" ref="service1Ref" />

    <int:gateway id="service1Ref" default-request-channel="success_channel" error-channel="error_channel" />

    <int:chain id="chainid1" input-channel="success_channel" output-channel="aggregator1">
        step 1 :xsl transformation 
        step 2 :call to a service using ws:outbound-gateway
            <int:service-activator id="sa1">
                <bean class="samplePkg.returnMessage"></bean>   <!--return message simply returns the message without doing anything -->
            </int:service-activator>    
    </int:chain>

    <int:chain id="chainid2" input-channel="error_channel" output-channel="aggregator1" >
                <int:service-activator>
                    <!-- some custom exception handling -->
                </int:service-activator>
    </int:chain>

    <!--service 2 code -->   same as service 1

步骤1:xsl转换
步骤2:使用ws:outbound gateway调用服务
与服务1相同

  • 问题:

  • 如果我不在服务1和服务2中使用网关,而只是简单地进行转换,那么代码就可以完美地工作

  • 但是,由于我需要使用error_通道进行一些错误处理,所以我在service1和service2代码中添加了一个网关。现在是流动 维修1中的维修后激活器卡住,但不抛出任何 例外。并且不调用服务2流


  • 您需要显示真实的配置,而不仅仅是注释;我们无法猜测您的应用程序是什么样子的

    也就是说,您不能只向聚合器发送错误消息,因为聚合信息位于
    failedMessage
    标题中,需要升级

    有关示例,请参见

    与往常一样,调试类似情况的第一步是打开
    org.springframework.integration
    的调试日志,并在流程中跟踪消息

    您通常可以通过这种方式确定问题