Wednesday 20 July 2011

Fault Management framework for Oracle SOA Suite


Fault management framework was introduced from BPEL PM 10.1.3.3. It’s the feature which enables fault management outside the service and through minimal configuration. This blog lists down the steps to implement the Fault Management Framework in Oracle SOA suite 11g. Following are the major steps:
1.       Create Fault-bindings.xml file
2.       Create Fault-Policies.xml file
3.       Make entries of fault-bindings and Fault-Policies  file in composite.xml file

Fault-bindings.xml
This file directs BPEL server that for which process, fault framework is implemented. Sample fault-bindings.xml looks like following:
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicyBindings version="2.0.1"
                     xmlns="http://schemas.oracle.com/bpel/faultpolicy"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <!-- only applies for the SampleBPELProcess  process -->

        <component faultPolicy=" ServiceFaults">
       <name>SampleBPELProcess</name>
        </component>
</faultPolicyBindings>

Fault-policies.xml file
Through this file, BPEL server would determine what has to be done when specific fault occurs. Sample Fault-policies.xml looks like following:

<?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="ServiceFaults"
 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:bpelx="http://schemas.oracle.com/bpel/extension"
 name="bpelx:remoteFault">
        <condition>
            <action ref="java-fault-handler"/> 
        </condition>
      </faultName>
   
    </Conditions>
    <Actions>
      <!-- Generics -->
       <Action id="java-fault-handler"> 
         <javaAction className="com.ent.SFault"
                    defaultAction="ora-human-intervention"> 
           <returnValue value="HW" ref="ora-human-intervention"/> 
        </javaAction> 
      </Action> 

      <Action id="default-human-intervention">
        <humanIntervention/>
      </Action>
     
    <!--  not used in project--> 
      <!-- This action will attempt 8 retries at increasing intervals of 2, 4, 8, 16, 32, 64, 128, and 256 seconds. -->
      <Action id="ora-retry">
                                                        <retry>
                                                                        <retryCount>3</retryCount>
                                                                        <retryInterval>2</retryInterval>
                                                                        <retryFailureAction ref="ora-terminate"/>
                                                                        <exponentialBackoff/>
                                                        </retry>
                                        </Action>
                                        <!-- This is an action will cause a replay scope fault-->
                                        <Action id="ora-replay-scope">
                                                        <replayScope/>
                                        </Action>
                                        <!-- This is an action will bubble up the fault-->
                                        <Action id="ora-rethrow-fault">
                                                        <rethrowFault/>
                                        </Action>
                                        <!-- This is an action will mark the work item to be "pending recovery from console"-->
                                        <Action id="ora-human-intervention">
                                                        <humanIntervention/>
                                        </Action>
                                        <!-- This action will cause the instance to terminate-->
                                        <Action id="ora-terminate">
                                                        <abort/>
                                        </Action>
     
      </Actions>
  </faultPolicy>
</faultPolicies>

Composite.xml
oracle.composite.faultPolicyFile and oracle.composite.faultBindingFile properties of composite.xml determines the path of Fault-bindings.xml and Fault-Policies.xml files. Sample entries for composite.xml are as follows:
<property name="oracle.composite.faultPolicyFile">fault-policies.xml</property>
 <property name="oracle.composite.faultBindingFile">fault-bindings.xml</property>