Mule ESB流程中的异常处理:多个异常策略

时间:2012-05-03 05:49:05

标签: web-services exception-handling esb mule flow

我想使用自定义异常策略在Mule ESB中添加异常处理。但是,我在一个流程中有多个服务调用,我想分别处理每个服务调用的异常。

是否可以在单个流程中拥有多个自定义异常策略?现在,我只能使用一个自定义异常策略,只有当我将它放在流的末尾,在最后一个出站端点之后。这是预期的行为。行。但是我想在流程中使用多个异常策略。

Mulesoft文档说如果我们想要使用多个异常策略,我们必须使用处理器链。我不确定它将如何转换为配置XML。有什么指导吗?

1 个答案:

答案 0 :(得分:1)

为此,您需要在私人流程中放置不同的服务电话。

类似的东西:

<flow name="main">
    <inbound-endpoint ref="in" />
    <flow-ref name="sub1" />
    <flow-ref name="sub2" />
</flow>

<flow name="sub1" processingStrategy="synchronous">
    <!-- do something -->
    <custom-exception-strategy>
        <!-- sub1 specific -->
    </custom-exception-strategy>
</flow>

<flow name="sub2" processingStrategy="synchronous">
    <!-- do something -->
    <custom-exception-strategy>
        <!-- sub2 specific -->
    </custom-exception-strategy>
</flow>