0
votes

I want to add exception handling in Mule ESB using custom-exception-strategy. However, I have multiple service calls in one flow, and I want to handle exceptions from each service call separately.

Is it possible to have multiple custom-exception strategies in a single flow? Right now, I am able to use only one custom-exception-strategy, and only when I place it at the end of the flow, after the last outbound endpoint. This is the expected behavior. All right. But I want to use multiple exception strategies in a flow.

The Mulesoft documentation says we have to use processor chains if we want to use multiple exception strategies. I am not sure how it will translate into the configuration XML. Any guidance?

1

1 Answers

1
votes

For this you need place your different service calls in private flows.

Something like:

<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>