Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

Reference Exception Strategy

You can create one or more global exception strategies to reuse in flows throughout your entire Mule application. First, create a global exception strategy, then add a Reference Exception Strategy to a flow to apply the error handling behavior of a specific global exception strategy.

When to Use

Use a reference exception strategy to instruct a flow to employ the error handling behavior defined by a global rollback exception strategy. In other words, you must ask your flow to refer to a global exception strategy for instructions on how to handle errors.

Applying a Global Rollback Exception Strategy to a Flow

  1. If you have not already done so, create a global catchrollback, or choice exception strategy to which your reference exception strategy can refer.

  2. From the Error Handling palette group, drag and drop the reference exception strategy icon into the footer bar of a flow. 

    reference+exception+1

  3. Open the Reference Exception Strategy’s Properties Editor, use the drop-down to reference the global catch exception strategy (below), then click anywhere on the canvas to save. 

    reference+exception+2

You can append a Reference Exception Strategy to any number of flows in your Mule application and instruct them to refer to any of the global catch, rollback or choice exception strategies you have created. You can direct any number of reference exception strategies to refer to the same global exception strategy.
  1. To your flow, below all the message processors, add an exception-strategy element.

  2. To the exception-strategy element, add attributes according to the table below. Refer to code below.

    Attribute Value

    ref

    Name of the global catch-exception-strategy in your project.

    doc:name

    Unique name for the exception strategy, if you wish. (Not required in Standalone.)


    
            
         
1
2
3
4
5
6
7
8
9
10
11
<catch-exception-strategy name="Catch_Exception_Strategy">
    <logger message="#[payload]" level="INFO" doc:name="Logger"/>
</catch-exception-strategy>
<flow name="Creation1Flow1" doc:name="Creation1Flow1">
    <http:inbound-endpoint host="localhost" port="8081" path="getSomething">
        <http:error-response-builder statusCode="#[errorStatusCode]" reasonPhrase="#[errorReasonPhrase]"/>
    </http:inblound-endpoint>
    <cxf:jaxws-service doc:name="SOAP"/>
...
    <exception-strategy ref="Catch_Exception_Strategy" doc:name="Reference Exception Strategy"/>
</flow> 
You can append a Reference Exception Strategy to any number of flows in your Mule application and instruct them to refer to any of the global catch, rollback or choice exception strategies you have created. You can direct any number of reference exception strategies to refer to the same global exception strategy.

See Also