mule流中web服务调用的并发处理

mule流中web服务调用的并发处理,mule,Mule,重新表述了问题- 我有一个要求,在单个mule流中,我必须进行3次web服务调用(S1、S2、S3) 我的要求是调用Service1并等待它完成(或者如果不成功并返回,则处理错误),然后并发/同时解除Service2和Service3。我想等待Service1的响应,因为我对Service2和Service3的调用使用Service1的部分响应作为输入。因此,我的mule流应该在触发Service2和Service3之前等待Service1的响应。但是如果Service1成功,它应该同时调用

重新表述了问题- 我有一个要求,在单个mule流中,我必须进行3次web服务调用(S1、S2、S3)


我的要求是调用Service1并等待它完成(或者如果不成功并返回,则处理错误),然后并发/同时解除Service2和Service3。我想等待Service1的响应,因为我对Service2和Service3的调用使用Service1的部分响应作为输入。因此,我的mule流应该在触发Service2和Service3之前等待Service1的响应。但是如果Service1成功,它应该同时调用Service2和Service3。 即使Service2和Service3中的一个失败,我也希望继续,而不是这个流的调用者失败/出错


任何类型的示例代码/链接都很好。

如果您想一个接一个地调用3个服务,并且任何服务的故障都不会影响剩余的流,那么您可以尝试以下类型的设计

<flow name="main_flow">
    <flow-ref name="private_flow_call_to_service_1"></flow-ref>
    <flow-ref name="private_flow_call_to_service_2"></flow-ref>
    <flow-ref name="private_flow_call_to_service_3"></flow-ref>
</flow>

<flow name="private_flow_call_to_service_1" processingStrategy="synchronous">
    <!-- call service 1  -->
    <catch-exception-strategy>
        <!-- Catch and handle any error or failure while making call to service 1 -->
    </catch-exception-strategy>
</flow>

<flow name="private_flow_call_to_service_2" processingStrategy="synchronous">
    <!-- call service 2  -->
    <catch-exception-strategy>
        <!-- Catch and handle any error or failure while making call to service 2 -->
    </catch-exception-strategy>
</flow>

<flow name="private_flow_call_to_service_3" processingStrategy="synchronous">
    <!-- call service 3  -->
    <catch-exception-strategy>
        <!-- Catch and handle any error or failure while making call to service 3 -->
    </catch-exception-strategy>
</flow>


希望这有帮助。

Mule分散-聚集组件用于并发执行多个流。 该组件已在Mule 3.5中引入
参考:-


为了确保一个流的故障不会影响另一个流,您可以将流包装在
块中

您的问题有点令人困惑。它是并行运行服务还是顺序运行服务(一个接一个)?
<flow name="main_flow">
    <flow-ref name="private_flow_call_to_service_1"></flow-ref>
    <flow-ref name="private_flow_call_to_service_2"></flow-ref>
    <flow-ref name="private_flow_call_to_service_3"></flow-ref>
</flow>

<flow name="private_flow_call_to_service_1" processingStrategy="synchronous">
    <!-- call service 1  -->
    <catch-exception-strategy>
        <!-- Catch and handle any error or failure while making call to service 1 -->
    </catch-exception-strategy>
</flow>

<flow name="private_flow_call_to_service_2" processingStrategy="synchronous">
    <!-- call service 2  -->
    <catch-exception-strategy>
        <!-- Catch and handle any error or failure while making call to service 2 -->
    </catch-exception-strategy>
</flow>

<flow name="private_flow_call_to_service_3" processingStrategy="synchronous">
    <!-- call service 3  -->
    <catch-exception-strategy>
        <!-- Catch and handle any error or failure while making call to service 3 -->
    </catch-exception-strategy>
</flow>