Introduction
Apart of the fault handling within the BPEL processes itself, a new feature is available in BPEL. This is called the fault handling. Previous the fault must all be handled within each process. An article on this is written in:
OraBPEL Technote #7
The new feature is documented in the release note of Oracle BPEL 10.1.3.3, in the chapter "Fault Management Framework".
BPEL 10.1.3.3 Release notes
Another nice article on BPEL fault handling with an example is written here.
Fault Business Rules
The fault policy is implemented for all the BPEL processes based on the following rules:
- Existing exception handling in the BPEL processes will be implemented as defined in the standards for that application.
- A distinction will be made in fault policies for synchronous and a-synchronous policies.
- The policies will be implemented at Oracle BPEL Process level.
- The default fault policy, valid for all BPEL processes, will be implemented as if there was no fault policy.
DefaultFaultPolicy
The default policy will catch all faults message and pass it back to the process that raises the fault. This is defined as follows:
DefaultPolicy.xml
=============
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicy
version="2.0.1"
id="DefaultPolicy"
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">
<!--
This section describes default conditions.
Build more conditions with faultName, test and action
-->
<!--
CONDITIONS
-->
<Conditions>
<faultName>
<condition>
<action ref="ora-rethrow-fault"/>
</condition>
</faultName>
</Conditions>
<!--
ACTIONS
-->
<Actions>
<!--
This is an action will bubble up the fault
-->
<Action id="ora-rethrow-fault">
<rethrowFault/>
</Action>
</Actions>
</faultPolicy>
The DefaultPolicy.xml file should be created in the following directory
$ORACLE_HOME/domain/<domain-name>/config/fault-policiesFor example
$ORACLE_HOME/domain/default/config/fault-policiesThe bind the DefaultPolicy.xml file as default fault policy handler. The following file must be created and filled with the following content:
$ORACLE_HOME/domain/<domain-name>/config/fault-bindings.xmlFor example
FaultPolicySynchronous
$ORACLE_HOME/domain/default/config/fault-bindings.xml
===================================================
<?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">
<!--
DefaultPolicy is defined
in ./fault-policies/DefaultPolicy.xml
-->
<process faultPolicy="DefaultPolicy"/>
<partnerLink faultPolicy="DefaultPolicy"/>
</faultPolicyBindings>
The fault policy for synchronous process is as follows. When a binding or remote fault occurs, it will retry calling this invoke/partnerlink again. It will retry this 5 times with an interval of 4 seconds. This means that if after 20 seconds the retry was still failing, it executes a re-thrown. Meaning that the fault is passed back to the process. The process van now handle the fault in his normal exception handling.
FaultPolicySynchronous.xml
==========================
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicy
version="2.0.1"
id="FaultPolicySynchronous"
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">
<!--
This section describes fault conditions.
Build more conditions with faultName, test and action
-->
<!--
CONDITIONS
-->
<Conditions>
<!--
Fault if wsdlRuntimeLocation is not reachable
-->
<faultName
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
name="bpelx:remoteFault">
<condition>
<action ref="ora-retry"/>
</condition>
</faultName>
<!--
Fault if location port is not reachable
-->
<faultName
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
name="bpelx:bindingFault">
<condition>
<action ref="ora-retry"/>
</condition>
</faultName>
</Conditions>
<!--
ACTIONS
-->
<Actions>
<!--
This action will attempt 5 retries with intervals of 4 seconds
retry after 4, 8, 12, 16, 20 seconds
-->
<Action id="ora-retry">
<retry>
<retryCount>5</retryCount>
<retryInterval>4</retryInterval>
<retryFailureAction ref="ora-rethrow-fault"/>
</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>
Copy the FaultPolicySynchronous.xml into the $ORACLE_HOME/bpel/domains/<domain-name>/config/fault-policies directory.
FaultPolicyASynchronous
The fault policy for a-synchronous process is as follows. When a binding or remote fault occurs, it will retry calling this invoke/partner link again. It will retry this 10 times with an interval of 2 seconds, growing exceptional. This means that 9 attempts with increased intervals of 2 seconds, it retries after 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 seconds, this will result in a duration of 2046 seconds; approx 34 minutes.
If after 34 minutes the retry was still failing, it executes a human-intervention. Meaning that the fault is waiting for human input. In the Oracle BPEL Console, on the activation tab, the processes is waiting on an action of the administrator.
FaultPolicyASynchronous.xmlCopy the FaultPolicyASynchronous.xml into the $ORACLE_HOME/bpel/domains/<domain-name>/config/fault-policies directory.
==========================
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicy
version="2.0.1"
id="FaultPolicyASynchronous"
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">
<!--
This section describes fault conditions.
Build more conditions with faultName, test and action
-->
<!--
CONDITIONS
-->
<Conditions>
<!--
Fault if wsdlRuntimeLocation is not reachable
-->
<faultName
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
name="bpelx:remoteFault">
<condition>
<action ref="ora-retry"/>
</condition>
</faultName>
<!--
Fault if location port is not reachable
-->
<faultName
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
name="bpelx:bindingFault">
<condition>
<action ref="ora-retry"/>
</condition>
</faultName>
</Conditions>
<!--
ACTIONS
-->
<Actions>
<!--
This action will attempt 9 retries with increased intervals of 2 seconds
retry after 2, 4, 8, 16, 32, 64, 128, 256, 512 seconds,
this will result in a duration of 1022 seconds; approx 17 minutes
-->
<Action id="ora-retry">
<retry>
<retryCount>9</retryCount>
<retryInterval>2</retryInterval>
<exponentialBackoff/>
<retryFailureAction ref="ora-human-intervention"/>
</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>
Implementation
The fault policies are read during startup of the Oracle BPEL PM. This means that new fault policies or policies that are changed can only be made available by restarting the BPEL PM.
All processes should be aware of the new fault policy mechanism. This means that synchronous process should use the "FaultPolicySynchronous" policy. A-Synchronous process should use the "FaultPolicyASynchronous" policy.
To implement the fault policy in a BPEL process, add the following lines in the BPEL.XML file for each process, just before the "</BPELProcess>" tag:
Synchronous processes:
<faultPolicyBindings>A-Synchronous processes:
<process faultPolicy="FaultPolicySynchronous"/>
</faultPolicyBindings>
<faultPolicyBindings>
<process faultPolicy="FaultPolicyASynchronous"/>
</faultPolicyBindings>

14 comments:
Thanks for the Post Marc.
I have used the Fault Policies in a similar way as you have suggested on BPEL projects implemented by my organisation. However when placing the fault policy details, as suggested in your post, in the bpel.xml file of the process. However JDeveloper seems to remove the settings when you edit the process (e.g.Add Partner Links). Have you experienced these problems? Is your Best Practice to only add these settings once the process has been completed?
Thanks David
This a known issue :-). If you change the content of the bpel.xml file, make sure you do not have any other windows open; meaning close all BPEL diagrams. JDeveloper is caching the bpel.xml file, closing the .bpel files will release the memoery, and use the file you have changed.
Marc
Thats Great :) Thanks for the response and the tip Marc
David
Hi Marc,
I'm trying to have a general policy that that just retry's a couple of times and then goes for the Human Interaction.
This is done. My problem currently is that i have an external Audit System that i need to update when the process goes into the Human Interaction. Is there any way that i can call a webservice when a remote fault occurs using the Fault Policies?
Alex,
The retry and java-action are chaining actions, i.e. you may call another action after executing them.
For your case, you may do retry -> java-action -> human-interaction.
And call the external websevice in you java action implementation.
Hi there,
I am software developer in eds best shore. Currently i am using oracle soa suite to build up the prototype of concept for our client. During my work, i have so many issues regarding the soa suite, especially in bpel and esb.
So what i care about is that could you provide a msn address or other im contacts to me, which is better for us to discuss about some related problems. I am really need your help~ thanks a lot. BTW, my msn address is yuechao1982@hotmailc.com Look forward to hear from you soon
Hi I am working on conceptualizing a Fault handling framework so that i can be used in any environment.
Here are the Key Requirements
• A generic fault handling framework based on the Error Hospital pattern capable of handling any fault as they occur by taking appropriate actions.
• A generic framework for logging and monitoring accessible to all systems participating in an integration process.
• Fulfil the requirements inflicted by the Integration Platform with respect to security, scalability and robustness.
• Two frameworks working independent of each other.
Many different user groups can potentially be involved is both the monitoring and the fault handling processes.
• End Users – Persons who use the business applications
• Support level 1 – In house resources providing end user support related to business faults
• Support level 2 – In house resources providing end user support related to technical support
• Operations – Technical resources typically providing support on infrastructure, hardware, operating systems and middleware components.
Can u help me in designing these. If you have already worked on this, would you be able to assist.
i can be contacted on mahesh.boovanahalli@gmail.com
Thanks,
Mahesh
Marc,
I have applied the two policies as you wrote them. Two of my bpel processes were constructed as "empty". The instance is created after a read from an AQ adapter. (it is the start of the bpel) After the message is loaded from the AQ adapter, the bpel uses a partner link to talk to a web service. I undeployed the web service and observed the exponential back off of the retries (not to mention the fact that I could see the policies getting loaded in the logs). When the retries gave up, I was expecting the human interaction, but that was not available. What could I be missing?
Thanks,
SCott
I am now fairly certain that only the default policy is getting executed. From review of the log, I can see the other two policies loading, and I have opened the suitcase "jar" and verified that the bpel.xml has the required element added.
OK - just discovered that my version of the default policy is different than yours. It is still the original default policy. What is the consequence of that?
Hi Marc,
I am trying to implement fault policy at process level(bpel.xml) for a BPEL process that is initiated by a synchronous JMS Adapter. This BPEL process inturn calls a synchronous child BPEL process. But when I switch off the child process and try to initiate the first BPEL with JMS Adapter, no instances appear on the BPEL Console. In the logs I am getting the following exception,
Error while invoking bean "activity manager": [com.collaxa.cube.engine.core.InstanceNotFoundException: Instance not found in datasource.
The process domain was unable to fetch the instance with key "6920002" from the datasource.
Please check that the instance key "6920002" refers to a valid instance that has been started and not removed from the process domain.
]
ORABPEL-02152
Instance not found in datasource.
The process domain was unable to fetch the instance with key "6920002" from the datasource.
Please check that the instance key "6920002" refers to a valid instance that has been started and not removed from the process domain.
But if I remove the fault policy binding from bpel.xml I am able to see faulted instances of the first bpel in the console.
hii,
I am studying about these bpel fualt policies, i am implementing one demo on this concept.
can anybody tell the actions which we are specifying in the fault policies like BPELJavaAction can anybody tell tell exactlt where we have to write the Java function and where we have to placa the .Calss file of that function, in order to cretae a link betwwen the java action which we have mentioned in the Fault policy to the Java Function which we have created.
Hoping for help
Did you read the release notes in this article. An example is described there.
Hello Everyone,
Can anybody tell me How to use JMS adapter in bpel.
I am getting problem in where to define those JMS_queues and topics how they will appear in our JMS adapter.
Prepackaged BPEL Error Handling www.karmaticIT.com
Post a Comment