Contact Us 1-800-596-4880

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

Studio Visual Editor

  1. If you have not already done so, create a global catch, rollback, 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.

    ref_ES-1
  3. Double-click to open the Reference Exception Strategy, use the drop-down to reference the global catch exception strategy (below), then click OK to save.

    ref_global-1
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.

You can create a global exception strategy (i.e. access the Choose Global Type panel) from the reference exception strategy’s pattern properties panel. Click the (plus) button next to the Global Exception Strategy drop-down and follow the steps to create a global catch, rollback, or choice exception strategy.

create_global

Studio XML Editor or Standalone

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

<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 exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
    <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