Fault handling is a feature provided in SOA Suite which enables to catch the faults that occurs during run time of a process and performs a user-specified action defined in a fault policy file associated with the activity.
There are two policy files
fault-policies.xml and fault policy bindings file fault-bindings.xml
They have to be placed in the same directory where composite.xml resides.
they can be also placed in different location,For this we need to add two properties in the composite.xml and this option is useful if we have multiple SOA composite applications.
Creating a Fault policy.
For creating a fault policy we create the file fault-policies.xml.
This file contains the conditions and the actions for the process.
Condition here implies under what situation we have to perform action
and action determines what action has to be perfomed for the respective condition.
We will just try to create on fault handling and find how it works.
So a simple fault-binding policy will contain the condition and action as
<Conditions>
<faultName xmlns:test="http://schemas.oracle.com/Test/faults"
name="test:SomeFault">
<condition>
<action ref="testJavaAction"/>
</condition>
</faultName>
Waht it means
It means whenever we have the condition that is the fault test:SomeFault we have to perform testJavaAction.
The action here refers to a reference testJavaAction which we need to define.
So we will define the action as follows
<Actions>
<Action id="testJavaAction">
<!-- this is user provided class-->
<javaAction className="testJavaAction.myClass"
defaultAction="default-terminate">
<returnValue value="MANUAL" ref="default-human-intervention"/>
</javaAction>
</Action>
</Action>
So the action we are performing here is to terminate and return value default-human-intervention
Which is again a refernce to another action
Let suppose we define it
<Action id="default-human-intervention">
<humanIntervention/>
</Action>
The default-human-intervention is a preseeded recovery action tag.So we need not define it.
We also need not return a value.
So in all our fault policie should look like this
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<faultPolicy version="0.0.1" id="FusionMidFaults"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.oracle.com/bpel/faultpolicy"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Conditions>
<faultName xmlns:test="http://schemas.oracle.com/Test/faults"
name="test:SomeFault">
<condition>
<action ref="testJavaAction"/>
</condition>
</faultName>
</Conditions>
<Actions>
<Action id="testJavaAction">
<!-- this is user provided class-->
<javaAction className="testJavaAction.myClass"
defaultAction="default-terminate">
<returnValue value="MANUAL" ref="default-human-intervention"/>
</javaAction>
</Action>
<Action id="default-human-intervention">
<humanIntervention/>
</Action>
</Actions>
</faultPolicy>
</faultPolicies>
you can refer to my following post for a working example on fault handling in SOA Suite 11g.
No comments:
Post a Comment