Runtime Faults Introduction to Categories of BPEL Faults

Using Fault Handling in a BPEL Process 11-7 ■ The fault policy file fault-policies.xml and fault policy bindings file fault-bindings.xml are placed in either of the following locations: – In the same directory as the composite.xml file of the SOA composite application. – In a different location that is specified with two properties that you add to the composite.xml file. This option is useful if a fault policy must be used by multiple SOA composite applications. This option overrides any fault policy files that are included in the same directory as the composite.xml file. Example 11–3 provides details about these two properties. In this example, the fault policy files are placed into the SOA Metadata Service MDS shared area. Example 11–3 Fault Policies used by Multiple SOA Composite Applications property name=oracle.composite.faultPolicyFileoramds:appsfaultpolicyfiles fault-policies.xml property property name=oracle.composite.faultBindingFileoramds:appsfaultpolicyfiles fault-bindings.xml property See Chapter 21, Using Oracle Mediator Error Handling for details about Oracle Mediator fault handling capabilities.

11.4.1 How to Design a Fault Policy

This section describes how to design a fault policy.

11.4.1.1 Understanding How Fault Policy Binding Resolution Works

A fault policy bindings file associates the policies defined in a fault policy file with the SOA composite application or the component service component or reference binding component. The framework attempts to identify a fault policy binding in the following order: ■ Reference binding component defined in the composite.xml file. ■ BPEL process or Oracle Mediator service component defined in the composite.xml file. ■ SOA composite application defined in the composite.xml file. Note: A fault policy configured with the fault management framework overrides any fault handling defined in catch activities of scope activities in the BPEL process. The fault management framework can be configured to rethrow the fault handling back to the catch activities. Note: The Facades API enables you to programmatically perform the abort, retry with a success action, continue, rethrow, and replay recovery options. For information, see Oracle Fusion Middleware Infrastructure Management Java API Reference for Oracle SOA Suite. 11-8 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite During the resolution process, if no action is found that matches the condition, the framework assumes that resolution failed and moves to the next resolution level. For example, assume an invoke activity faults with faultname=abc. There is a policy binding specified in the fault-binding.xml file: ■ SOA composite application binds to policy-id-1 ■ BPEL process or Oracle Mediator service component or reference binding component binds to policy-id-2 In the fault-bindings.xml file, the following bindings are also specified: ■ SOA composite application binds to policy-id-3 ■ Reference binding component or service component binds to policy-id-4 The fault management framework behaves as follows: ■ First match the resolve binding in this case, policy-id-2. ■ If the fault resolution fails, go to the next possible match policy-id-4. ■ If the fault resolution fails, go to the next possible match policy-id-3. ■ If the fault resolution fails, go to the next possible match in this case, policy-id-1. ■ If the fault resolution still fails, the fault is sent to the BPEL fault catch activity.

11.4.1.2 Creating a Fault Policy File for Automated Fault Recovery

1. Create a fault policy file for example, named fault-policies.xml. This file

includes condition and action sections for performing specific tasks.

2. Place the file in the same directory as the composite.xml file or place it in a

different location and define the oracle.composite.faultPolicyFile property. Example 11–4 provides details. Example 11–4 Defining Properties property name=oracle.composite.faultPolicyFileoramds:appsfaultpolicyfiles fault-policies.xml property property name=oracle.composite.faultBindingFileoramds:appsfaultpolicyfiles fault-bindings.xml property 3. Define the condition section of the fault policy file. ■ Note the following details about the condition section: – This section provides a condition based on faultName. – Multiple conditions may be configured for a faultName. – Each condition has one test section an XPath expression and one action section. – The test section XPath expression is evaluated for the fault variable available in the fault. – The action section has a reference to the action defined in the same file. – You can only query the fault variable available in the fault.