Tuesday, November 23, 2010

Fault Handling in SOA 11g

The configuration of the fault management Framework for a SCA component has been made more flexible than it was in 10g. We can configure fault policies not only on composite level but also on component level. This enables us to configure retry policies not only on an error type and filter but also on specific components. To do this you just need two files:
You have to enable the fault policy by adding the files to your sca component, or you can add a reference in the sca component to hem, for example when they are placed in the mds.
fault-bindings.xml
Examples of fault-bindings.xml files can be found in oracle’s documentations:
fault-policies.xml
An detailed fault-policies.xml file can be found here.
Mediator
The Fault Management Framework is only applicable for mediators that processes their rules parallel, see documentation Fault Policies Mediator. If an error is matched in the fault policy an possible predefined fault action in the mediator will be ignored. Be aware of this when you are defining your fault policies and error handling.
Example
I have made a simple sca component to show the working of the framework. This sca component has two components {BPEL and Mediator} which are exposed as services to the outside world.

CompositeOverview
They will pass the message to a BPEL that throws a remote exception so we can test the working of the configured fault policies and bindings. In this case a simple available exception but in real it could be an custom defined Business exception to trigger the fault handling. We will see also the way to recover an BPEL instance and a Mediator instance.
RemoteExceptionBPEL
The fault-policies.xml that’s configured in this project
FaultPoliciesXml
This fault-bindings.xml that’s configured in this project
FaultBindingsXml
If you would like to define on component level the fault policies the fault-bindings.xml would look like this
FaultPoliciesXmlComponent
Testing the composite
We deploy the composite and test if all the instances are cached by the defined fault policy.
Mediator Routing
First i invoked the service that’s connected to the mediator routing.
InvokeMediatorRouting
De defined fault policy works fine because the instance is been marked recoverable. By clicking on the link ‘Recoverable’ you get a popup where you can modify the payload (if needed) and select a recover action.InvokeMediatorRoutingRecover
BPELRouting
Second i tested the service that’s connected to the BPELRouting component.
InvokeBPELRouting
We have here also the same link to recover this instance.
InvokeBPELRoutingRecover
That’s the end of a simple example to get started with the Fault Management Framework.

5 comments: