In certain situations the default set of faults defined by Oracle aren’t suited enough and you need to define your own faults. If we look into the examples which got supplied by Oracle we can see an example over here. In this example they defined their own NegativeCredit-fault. The Oracle BPEL Fault Policy Framework by default only handles the faults which are getting returned on an invoke-activity. So we have our own custom fault and the knowledge we can only let this fault getting catched by the framework by use of an invoke. So we need atleast for this testscenario 2 bpel processes. One mainprocess which calls a subprocess, and this subprocess will throw the custom business fault. This fault will get propogated back to the mainprocess and in here we will be able to let the framework handle the fault. BPEL Processes Mainprocess Subprocess Just a simple invoke of the subprocess from the mainprocess. The subprocess with throw a fault, and this fault will be catched in the mainprocess. The fault to be thrown From the console start the mainprocess and wait till it comes back with a fault messageClick the activity to see the thrown fault
So the custom fault we defined in the subprocess reaches the mainprocess. Now we need to config the fault policy framework so it will get active on our custom business fault. From the fault we pasted above we need the faultname (BusinessFault) and the namespace (http://nl.iteye/integration/faults/business). Edit /bpel/domains/default/config/fault-policies/DefaultPolicy.xml and add the next fault :
Now restart the components opmnctl stopall opmnctl startall Now start the mainprocess again and wait till it fails. It looks like the framework got active (activity yellow marked) on our custom business fault. Go to the activities-tab And click the activity which faulted. Now we can edit some of the values and let the subprocess get re-invoked. So, at this moment we’re able to throw our custom business faults and let them getting catched by the framework. Since the fault is only getting catched on the invoke of a partnerlink, we aren’t able to let our custom business fault getting throwned to the process in which we maybe want do something with the data for which we actually throwed the custom business fault. So maybe we want to stay in the subprocess and somehow get the custome business fault thrown inhere, let the framework catch it and update the values of this subprocess with new values an re-execute the subprocess. The next solution will get this done. The mainprocess won’t get changed but in the subprocess we will invoke a new process called AllBusinessFaults. New subprocess 2 AllBusinessFaults The AllBusinessFaults will throw the custom business fault we ‘request’ back on the invoke in this subprocess. Now it wil get catched by the framework and we will be able to change the values of the subprocess instead of the mainprocess. By using the AllBusinessFaults bpel service like a sort of composite service, we can add the custom business faults in it and throw the one we would like to get thrown. This will work if the collection of custom business faults isn’t that big. I’m sure there will be better solutions for this, but for the scenario i wanted to describe inhere it was good enough for me. |
Friday, May 11, 2012
Oracle BPEL Fault Policy Framework handling custom business faults
########
at 10:35 AM
Labels: BPEL, Fault Handling
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment