Introduction
In this blog we see error handling in BPM using 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
Similarly, We 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)
- Retry
- Human intervention
- Terminate
- Java code
1. Composite Level Fault Policies
In this demo we will try to insert new employee records into database and check how error framework behaves when exception raised by bpm process.
Employee Business Object
FaultThrower bpm process
Input request mapping
Service mapping
ErrorHandlerProcess bpm process
Create fault-policies.xml
file in root folder of project.<?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="comp_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>
As mentioned in the fault policy file, if any error occurs, error framework will try three times in 10 second interval.
Create fault_binding.xml in root folder of project.
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicyBindings version="2.0.1" xmlns="http://schemas.oracle.com/bpel/faultpolicy">
<composite faultPolicy="comp_faultPolicy"/>
</faultPolicyBindings>
Configure these files in composite.xml file
I tried to insert dupilcate record in database whcich causes db adapter to throw binding fault in FaultThrower bpm proces. As per fault policy error framework retried to insert same record 3 times and then end the bpm process.
2. Service Component Level Fault Policies
Similarly we can define fault policies for service componentfault-policies.xml
<?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="ComponentPolicy"
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>
fualt-bindings.xml
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicyBindings version="2.0.1" xmlns="http://schemas.oracle.com/bpel/faultpolicy">
<component faultPolicy="ComponentPolicy">
<name>TestProcess</name>
</component>
</faultPolicyBindings>
3. Reference Level Fault Policies
Same way we can define fault policies for reference servicesfault-policies.xml
<?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>
fault.bindings.xml
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicyBindings version="2.0.1" xmlns="http://schemas.oracle.com/bpel/faultpolicy">
<!-- reference FolderListing is a reference to a file adapter -->
<reference faultPolicy="Policy0">
<name>Services.Externals.WriteFile_Orderdata.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 named Services.Externals.TestProcess2Service.reference.
fault-policies.xml
<?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="Policy1"
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>
fault.bindings.xml
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicyBindings version="2.0.1" xmlns="http://schemas.oracle.com/bpel/faultpolicy">
<!-- reference ProcessService1 calls BPMN component Process -->
<reference faultPolicy="Policy1">
<name>Services.Externals.TestProcess2Service.reference</name>
</reference>
</faultPolicyBindings>
Reference service name can be obtained from composite.xml from the wire section
In next blog we will see how to handle System Exception.
Please share the system Exception handling in BPM
ReplyDeleteone of the best explanation, keep sharing :)
ReplyDeleteThank you for your articles that you have shared with us. Hopefully you can give the article a good benefit to us. BPM en la nube
ReplyDeleteIam so thrilled because of finding your alluring website here.Actually i was searching for Oracle BPM.Your blog is so astounding and informative too..Iam very happy to find such a creative blog. Iam also find another one by mistake while am searching the same topicOracle SQL.Thank you soo much..
ReplyDeleteHow to play slot machines at Mohegan Sun - JTM Hub
ReplyDeleteYou can't do all those 삼척 출장샵 things like slot machines 충주 출장샵 in 전라북도 출장마사지 an indoor bathroom. The casino 용인 출장안마 floor at Mohegan Sun offers 1,600 slot machines, 70 경기도 출장샵 table games,