Studio Visual Editor
-
If you have not already done so, create a global catch, rollback, or choice exception strategy to which your reference exception strategy can refer.
-
From the Error Handling palette group, drag and drop the reference exception strategy icon into the footer bar of a flow.
-
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.
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.
Studio XML Editor or Standalone
-
To your flow, below all the message processors, add an
exception-strategy
element. -
To the
exception-strategy
element, add attributes according to the table below. Refer to code below.
Attribute | Value |
---|---|
ref |
Name of the global |
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>
<http:listener-config name="Http_Listener_Configuration" host="localhost" port="8081" doc:name="HTTP Listener Configuration"/>
<flow name="Creation1Flow1" doc:name="Creation1Flow1">
<http:listener config-ref="Http_Listener_Configuration" path="getSomething" allowedMethods="GET" doc:name="Retrieve person">
<http:error-response-builder statusCode="#[errorStatusCode]" reasonPhrase="#[errorReasonPhrase]"/>
</http:listener>
<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. |