Spring integration 具有多个webservice调用的Enricher模式

Spring integration 具有多个webservice调用的Enricher模式,spring-integration,Spring Integration,如何在使用enricher模式时使用筛选或从链返回 这是我的设想 我使用enricher模式从请求通道中检索数据,然后使用它来丰富有效负载。 请求通道将调用多个Web服务来检索数据。仅当第一个Web服务具有有效数据时,才需要调用第二个Web服务。如果没有,我需要回到恩里彻。 当筛选发生时,我得到以下异常:org.springframework.integration.handler.ReplyRequiredException:处理程序未生成任何回复 我的消息流是否正确或需要添加其他内容

如何在使用enricher模式时使用筛选或从链返回

这是我的设想 我使用enricher模式从请求通道中检索数据,然后使用它来丰富有效负载。 请求通道将调用多个Web服务来检索数据。仅当第一个Web服务具有有效数据时,才需要调用第二个Web服务。如果没有,我需要回到恩里彻。 当筛选发生时,我得到以下异常:org.springframework.integration.handler.ReplyRequiredException:处理程序未生成任何回复

我的消息流是否正确或需要添加其他内容

    <si:enricher id="enricher" input-channel="channelone"
request-channel="retrieveDataChannel" output-channel="outputChannel" >
    <si:property name="amount"    expression="payload.amount"/>

</si:enricher>


<si:chain id="dataChain" input-channel="retrieveDataChannel"  >
    <si:header-enricher >
        <si:header name="Content-Type" value="application/json" />
    </si:header-enricher>   


    <si-http:outbound-gateway id="Gateway1" 
                       url="http://$webservice{host}"                                               
                       http-method="POST" 
                       rest-template="restTemplate"
                       expected-response-type="com.xxx.response.Response1">
    </si-http:outbound-gateway>     

    <si:filter expression="payload.amount lt 30"  />



    <si-http:outbound-gateway id="Gateway2" 
                       url="http://$webservice{host}"                                               
                       http-method="POST" 
                       rest-template="restTemplate"
                       expected-response-type="com.xxx.response.AmountResponse">
    </si-http:outbound-gateway>         


</si:chain> 

如果您处于请求/回复流中,则不能仅在链中添加
;enricher将永远等待答复


最简单的方法是将第二个网关移出链,使链的最后一个组件成为一个
,并在数据良好时路由到网关,以及一些错误处理服务,否则将返回一些错误结果。

感谢您提供的信息。即使我使用路由器路由到第二个网关,如果数据不好,那么enricher仍将等待回复。你如何处理这种情况就像我说的,你也必须在错误路径上返回一些东西,或者你可以在错误路径上抛出一个异常,它将被传播到enricher的任何团队。