19 Using Fault Handling in BPM

19.1 Handling Faults with the Fault Management Framework

Oracle SOA Suite provides a generic fault management framework for handling faults. If a fault occurs during runtime, the framework catches the fault and performs a user-specified action defined in a fault policy file. If a fault results in a condition in which human intervention is the prescribed action, you perform recovery actions from Oracle Enterprise Manager Fusion Middleware Control. You can also use the fault management framework with Oracle BPM Suite.

For more information about the fault management framework, see Section "Handling Faults with the Fault Management Framework" of Oracle Fusion Middleware Developer's Guide for Oracle SOA Suite.

19.1.1 How to Design Fault Policies for Oracle BPM Suite

You can design and execute fault policies for Oracle BPM Suite. The fault policies file defines fault conditions and their corresponding fault recovery actions. The fault policy bindings file associates the policies defined in the fault policies file with one of the following:

  • Composite with a BPMN process

  • Oracle BPMN process service component

  • Reference binding component (for example, another BPMN process or a JCA adapter)

The following fault recovery actions are supported in the fault policies file for Oracle BPM Suite:

  • Retry

  • Human intervention

  • Terminate

  • Java code

Note:

The replay scope and rethrow recovery actions are not currently supported for Oracle BPM Suite. For more information about the supported retry, human intervention, terminate, and Java code fault recovery actions, see Section "Creating a Fault Policy File for Automated Fault Recovery" of Oracle Fusion Middleware Developer's Guide for Oracle SOA Suite.

19.1.1.1 Designing Composite Level Fault Policies

Figure 19-1 shows a composite that includes BPMN process service components named Process and FaultThrower.

Figure 19-1 Composite with Process and FaultThrower BPMN Process Service Components

Description of Figure 19-1 follows
Description of "Figure 19-1 Composite with Process and FaultThrower BPMN Process Service Components"

Example 19-1 shows the fault conditions and their corresponding fault recovery actions defined in the fault-policies.xml file. A condition catches faults and transfers them to actions for recovering from the faults during runtime.

Example 19-1 Fault Policies File

<?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="ravi_faultPolicy"
                 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>
            <!-- catches all -->
            <faultName>
                <condition>
                   <action ref="Action-Retry"/>
                </condition>
            </faultName>
        </Conditions>
        <Actions>
            <Action id="Action-Abort">
                <abort/>
            </Action>
            <Action id="Action-Retry">
                  <retry>
                    <retryCount>3</retryCount>
                    <retryInterval>10</retryInterval>
                    <exponentialBackoff/>
                    <retryFailureAction ref="Action-human-intervention"/>
                </retry>
            </Action>
            <Action id="Action-human-intervention">
                <humanIntervention/>
            </Action>
        </Actions>
     </faultPolicy>
</faultPolicies>

Example 19-2 shows the fault policy bindings file that associates the fault recovery policies defined in the fault-policies.xml file with the entire composite.

Example 19-2 Fault Policy Bindings File

<?xml version="1.0" encoding="UTF-8" ?>
<faultPolicyBindings version="0.0.1"
 xmlns="http://schemas.oracle.com/bpel/faultpolicy"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <composite faultPolicy="ravi_faultPolicy"/>
</faultPolicyBindings>

19.1.1.2 Designing Service Component Level Fault Policies

shows a composite in which a BPMN service component named BPMNThatFails invokes a reference binding component (for this example, a file adapter).

Figure 19-2 Composite with BPMN Process Service Component

Description of Figure 19-2 follows
Description of "Figure 19-2 Composite with BPMN Process Service Component"

Example 19-3 shows the fault conditions and their corresponding fault recovery actions defined in the fault-policies.xml file. A condition catches faults and transfers them to actions for recovering from the faults during runtime.

Example 19-3 Fault Policies File

<?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="FailsTrulyPolicy"
                 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>
        <!-- catches all -->
        <faultName>
            <condition>
               <action ref="Action-human-intervention"/>
            </condition>
        </faultName>
    </Conditions>
    <Actions>
        <Action id="Action-Abort">
            <abort/>
        </Action>
        <Action id="Action-Retry">
              <retry>
                <retryCount>3</retryCount>
                <retryInterval>2</retryInterval>
                <exponentialBackoff/>
            </retry>
        </Action>
        <Action id="Action-human-intervention">
            <humanIntervention/>
        </Action>
    </Actions>
  </faultPolicy>
</faultPolicies>

Example 19-4 shows the fault policy bindings file that associates the fault recovery policies defined in the fault-policies.xml file with the BPMNThatFails BPMN service component.

Example 19-4 Fault Policy Bindings File

<?xml version="1.0" encoding="UTF-8" ?>
<faultPolicyBindings version="0.0.1"
 xmlns="http://schemas.oracle.com/bpel/faultpolicy"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <component faultPolicy="FailsTrulyPolicy">
        <name>BPMNThatFails</name>
    </component>
</faultPolicyBindings>

19.1.1.3 Designing Reference Level Fault Policies (Calling a BPM Process)

Figure 19-3 shows a composite in which a BPMN process named Caller invokes another BPMN process named ProcessService1 as a reference.

Figure 19-3 Composite with Caller BPM Process

Description of Figure 19-3 follows
Description of "Figure 19-3 Composite with Caller BPM Process"

Example 19-5 shows the fault conditions and their corresponding fault recovery actions defined in the fault-policies.xml file. A condition catches all faults and transfers them to an action that requires human intervention to recover from the fault.

Example 19-5 Fault Policies File

<?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="Policy0"
                 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>
            <!-- catches all -->
            <faultName>
                <condition>
                  <action ref="Action-human-intervention"/>
                </condition>
            </faultName>
        </Conditions>
        <Actions>
            <Action id="Action-human-intervention">
                <humanIntervention/>
            </Action>
        </Actions>
     </faultPolicy>
</faultPolicies>

Example 19-6 shows the fault-bindings.xml file that associates the fault policies defined in fault-policies.xml with the reference.

Example 19-6 Fault Policy Bindings File

<faultPolicyBindings version="0.0.1"
 xmlns="http://schemas.oracle.com/bpel/faultpolicy"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <!-- reference ProcessService1 calls BPMN component Process -->
    <reference faultPolicy="Policy0">
        <name>Services.Externals.ProcessService1.reference</name>
    </reference>
</faultPolicyBindings>

When a process is called using a service reference, the reference used is not the BPMN process reference, but rather the reference created to call the BPMN process (ProcessService1 in Figure 19-3) named Services.Externals.ProcessService1.reference. The reference name is created as follows:

  • Services.Externals. is prefixed to the reference name of ProcessService1.

  • .reference is appended to the reference name of ProcessService1.

You can obtain the reference name to specify in the fault-bindings.xml file from either of the following files:

  • From the reference section of the process_name.componentType file, as shown in Example 19-7.

    Example 19-7 Reference Name in componentType File

    <componentType
    . . .
    . . .
      <reference name="Services.Externals.ProcessService1.reference"
      . . .
      . . .
      </reference>
    </componentType>
    
  • From the wire section of the composite.xml file, as shown in Example 19-8.

    Example 19-8 Reference Name in the composite.xml File

    <wire>
    <source.uri>Caller/Services.Externals.ProcessService1.reference
     </source.uri>
    . . .
    </wire>
    

This reference calls a BPMN process, but it can also invoke an FTP server, an EJB component, or something else.

19.1.1.4 Designing Reference Level Fault Policies (Calling a File Adapter)

Figure 19-4 shows a composite in which a BPMN process named Caller invokes a file adapter named FolderListing as a reference.

Figure 19-4 Composite with Caller BPM Process

Description of Figure 19-4 follows
Description of "Figure 19-4 Composite with Caller BPM Process"

Example 19-9 shows the fault conditions and their corresponding fault recovery actions defined in the fault-policies.xml file. A condition catches all faults and transfers them to an action that requires human intervention to recover from the fault.

Example 19-9 Fault Policies File

<?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="Policy0"
                 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>
            <!-- catches all -->
            <faultName>
                <condition>
                  <action ref="Action-human-intervention"/>
                </condition>
            </faultName>
        </Conditions>
        <Actions>
            <Action id="Action-human-intervention">
                <humanIntervention/>
            </Action>
        </Actions>
     </faultPolicy>
</faultPolicies>

Example 19-10 shows the fault-bindings.xml file that associates the fault policies defined in fault-policies.xml with the reference.

Example 19-10 Fault Policy Bindings File

<faultPolicyBindings version="0.0.1"
 xmlns="http://schemas.oracle.com/bpel/faultpolicy"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <!-- reference FolderListing is a reference to a file adapter -->
    <reference faultPolicy="Policy0">
        <name>Services.Externals.FolderListing.reference</name>
    </reference>
</faultPolicyBindings>

19.1.1.5 What You May Need to Know About the Difference Between Reference Naming Conventions in Oracle SOA Suite and Oracle BPM Suite

For external services, the reference name used in the fault policy bindings file is different between Oracle SOA Suite and Oracle BPM Suite. Table 19-1 provides details.

Table 19-1 Naming Conventions for References in the .componentType and Fault Policy Binding Files

Reference Naming Convention Entry in .componentType File Entry in Fault Policy Bindings File

For Oracle BPM Suite, the naming convention is as follows:

  • Services.Externals. is prefixed to the reference name.

  • .reference is appended to the reference name.

The naming convention in the BPMN_process_name.componentType file for a reference named Synch_read is as follows:

<reference name= "Services.Externals.Synch_read.
  reference"
  ui:wsdlLocation="synch_read.wsdl">
  <interface.wsdl interface=
 "http://xmlns.oracle.com/pcbpel/
  adapter/file/UpdateTaskApps/
  FaultPolicyApp/synch_read#
  wsdl.interface(SynchRead_ptt)"/>
</reference>

For Oracle BPM Suite, specify Services.Externals.Synch_read.reference:

<reference faultPolicy="Policy0">
<name>Services.Externals.Synch_
read.reference</name>

For more information, see Example 19-6 and Example 19-10.

For Oracle SOA Suite, no names are prefixed or appended to the reference name.

The naming convention in the BPEL_process_name.componentType file for a reference named Synch_read is as follows:

<reference name="Synch_read"
 ui:wsdlLocation="synch_read.wsdl">
 <interface.wsdl interface=
 "http://xmlns.oracle.com/pcbpel/
 adapter/file/UpdateTaskApps/ 
 FaultPolicyApp/synch_read#
 wsdl.interface(SynchRead_ptt)"/>
</reference>

For Oracle SOA Suite, specify Synch_read:

<reference faultPolicy="Policy0">
    <name>Synch_read</name>

Note:

You can also define a single fault policy bindings file to catch faults from both Oracle BPM Suite and Oracle SOA Suite.