Tuesday, April 15, 2008

Exception framework in

Some bullet points about the framework:
1) It works only for the faults raised thru invoke activity.
It doesn't seem to be capturing faults thrown using throw activity.
2) It captures any type fault: Business or Runtime fault.
3) Two things must be specified:
1) Fault Policy file(in /domains/default/config/fault-policies directory.)
Specifies actions for faults.
Lists the actions to be used for the faults.
2) Fault Bindings (Either in bpel.xml file OR in /domains/default/config/fault-bindings.xml file)
-> Remember "default" in the path refers to a domain name. Which could be replace by any other existing domain name.
Binds the faults to Partner Link, Port Type and/or Process.
Can be specified at process level or domain level.

Let's see what happens when an invoke activity receives a fault:

1) Framework first captures the fault.
2) It then checks the bpel.xml file, if any bindings are specified. If not, then domain level bindings are checked. This is to determine which policy file is to be used.
3) Invoke activity has PartnerLink name, Port Type name.
These two are used as a criteria to determine fault policy file.

The order of bindings being probed are as follows:

1) Partner link in bpel.xml file
2) Port type in bpel.xml file
3) Process in bpel.xml file
4) Partner link in fault-bindings.xml file
5) Port type in fault-bindings.xml file
6) Process in fault-bindings.xml file

If nothing matches in these bindings, the fault is handled by the faultHandler.

If a match is found in let's say step-1, remaining steps are not looked at.
So if partner link binding in bpel.xml file is found, the corresponding policy is used and fault policy resolution process stops there itself. s

Remember that, bindings in fault-bindings.xml are at domain level. So they apply to all the processes deployed in the domain.

Once fault policy file is determined, the framework tries to match the fault which occurred in invoke activity to the list of fault-conditions in policy file sequentially. This is similar to deciding exception handler for an exception in any programming language.

Once condition matches, the corresponding action is executed for recovery.

There could be the following actions:
1) Retry
2) Replay
3) Rethrow
4) Terminate
5) Human Interaction
6) JavaAction

No comments: