navigation

How to make a custom fault handling for a BPEL process

How to make a custom fault handling for a BPEL process

Every SOA application needs to establish a set of rules for handling faults. In this blog I will show you how to make a custom fault handling for a BPEL process.

Usually in the BPEL processes this is possible thanks to the fault-policies.xml. In it are defined all the actions that can be done when an error occurs. The policies that can be used in the application are defined in the fault-bindings.xml. They can affect different scope of the SOA application – service components, BPEL process or even the whole SOA application.

The basic construction of the fault-bindings.xml and fault-policies.xml documents represents a rule that is applied for all types of faults and for the whole SOA application. They are usually located in the same directory as the composite.xml of the SOA application.

But how should we construct our policy if we need a single different rule for a single BPEL?

First we should define a new policy that affects only the desired BPEL in
fault-bindings.xml

The whole fault-binding.xml document content should look like this:

custom-fault-handling-BPEL

After that we will define the rules for this policy inside the tag in the fault-policies.xml

Defined like this the default action for our policy will be for any type of fault to rethrow that fault. Remember, if we want to apply the rules only for a specific fault (runtime fault for example) we should define it inside the tag <Conditions> like this:

Different types of actions can be defined inside the fault policy.

Basic ones are:

The abort action terminates the faulted process.

The human intervention action stops the current activity from processing and waits for manual recovery that can happen when the user logs in the Oracle Enterprise Manager.

Retry the setted number of times in the <retryCount>.
Exponential back off indicates the next retry attempt will increase double the retry delay starting with the <retryInterval> value.
If the activity has reached the maximum retry counts, retryFailureAction will be executed.

Example fault-policies.xml content:

custom-fault-handling-BPEL-2

 

In order for the new rules to be applied we need to redeploy the SOA application.

If you want to learn more about how to design the perfect fault handling you can find that information in the Oracle® Fusion Middleware Modeling and Implementation Guide for Oracle Business Process Management.

Smilena Madzhirova

Java Developer at Dreamix

More Posts

Do you want more great blogs like this?

Subscribe for Dreamix Blog now!