Compensation handler sample
Hello.
I have two different scopes in sequence. Each scope invokes a web service - this works whithout problems.
In the second scope I will catch an Exception; this works fine, too. If the the exception is caught in the second scope I would like to compensate the first scope.
And here is my problem: The catch block in scope 2 catches the exception but the <compensate ..> could not call the compensationHandler of scope 1. Does someone know the reason why?
If you need my .bpel file here is it:
<process name="CompensationTest1"
targetNamespace="http://acm.org/samples"
suppressJoinFailure="yes"
xmlns:tns="http://acm.org/samples"
xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
xmlns:ora="http://schemas.oracle.com/xpath/extension"
xmlns:nsxml0="http://ams.ws" xmlns:nsxml1="http://ams.ws/types"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
<partnerLinks>
<partnerLink name="client"
partnerLinkType="tns:CompensationTest1"
myRole="CompensationTest1Provider"
partnerRole="CompensationTest1Requester"/>
<partnerLink name="partnerLink"
partnerLinkType="nsxml0:ReservationEndpointLink"
partnerRole="ReservationEndpointProvider"/>
</partnerLinks>
<variables>
<variable name="input"
messageType="tns:CompensationTest1RequestMessage"/>
<variable name="output"
messageType="tns:CompensationTest1ResponseMessage"/>
<variable messageType="nsxml0:ReservationEndpoint_printFirstString"
name="inFirstString"/>
<variable messageType="nsxml0:ReservationEndpoint_printFirstStringResponse"
name="outFirstString"/>
<variable messageType="nsxml0:ReservationEndpoint_compensateFirstString"
name="inCompensateFirst"/>
<variable messageType="nsxml0:ReservationEndpoint_compensateFirstStringResponse"
name="outCompensateFirst"/>
<variable messageType="nsxml0:ReservationEndpoint_printSecondString"
name="inSecondString"/>
<variable messageType="nsxml0:ReservationEndpoint_printSecondStringResponse"
name="outSecondString"/>
<variable messageType="nsxml0:WebServiceException"
name="WebServiceException"/>
<variable messageType="nsxml0:ReservationEndpoint_compensateFirstString"
name="inCatchCompensateFirstStr"/>
<variable messageType="nsxml0:ReservationEndpoint_compensateFirstStringResponse"
name="outCatchCompensateFirstStr"/>
</variables>
<faultHandlers>
<catchAll>
<compensate name="compensate-2" scope="scope-4"/>
</catchAll>
</faultHandlers>
<sequence name="main">
<receive name="receiveInput" partnerLink="client"
portType="tns:CompensationTest1"
operation="initiate"
variable="input"
createInstance="yes"/>
<scope name="scope-4">
<compensationHandler>
<invoke name="invoke-9" partnerLink="partnerLink"
portType="nsxml0:ReservationEndpoint"
operation="compensateFirstString"
inputVariable="inCompensateFirst"
outputVariable="outCompensateFirst"/>
</compensationHandler>
<sequence>
<invoke name="invoke-1"
partnerLink="partnerLink"
portType="nsxml0:ReservationEndpoint"
operation="printFirstString"
inputVariable="inFirstString"
outputVariable="outFirstString"/>
</sequence>
</scope>
<scope name="scope-2">
<faultHandlers>
<catchAll>
<compensate name="compensate-6" scope="scope-4"/>
</catchAll>
</faultHandlers>
<sequence>
<assign name="assign-3">
<copy>
<from variable="input" part="payload" query="/tns:CompensationTest1Request/tns:input"></from>
<to variable="inSecondString" part="parameters" query="/nsxml1:printSecondString/int_1"/>
</copy>
</assign>
<invoke name="invoke-2"
partnerLink="partnerLink"
portType="nsxml0:ReservationEndpoint"
operation="printSecondString" inputVariable="inSecondString"
outputVariable="outSecondString"/>
</sequence>
</scope>
<invoke name="callbackClient" partnerLink="client"
portType="tns:CompensationTest1Callback" operation="onResult"
inputVariable="output"/>
</sequence>
</process>Thanks in advance for your help!
best regards
Thanks Ryan for helping. I agree with Ryan. The compensation can be initated by the parent scope, i would have a main scope and define two child scopes and don't catch the fault in scope-2, it will bubble automatically to the parent scope..so it will go to mainScope's faultHandler..inside the fault handler you can call the compansate activity for scope-4, like below, please let me know if this doesn't work:
<scope name="mainScope">
<faultHandlers>
<catchAll>
<compensate name="compensate-2" scope="scope-4"/>
</catchAll>
</faultHandlers>
<sequence name="main">
<receive name="receiveInput" partnerLink="client"
portType="tns:CompensationTest1"
operation="initiate"
variable="input"
createInstance="yes"/>
<scope name="scope-4">
<compensationHandler>
<invoke name="invoke-9" partnerLink="partnerLink"
portType="nsxml0:ReservationEndpoint"
operation="compensateFirstString"
inputVariable="inCompensateFirst"
outputVariable="outCompensateFirst"/>
</compensationHandler>
<sequence>
<invoke name="invoke-1"
partnerLink="partnerLink"
portType="nsxml0:ReservationEndpoint"
operation="printFirstString"
inputVariable="inFirstString"
outputVariable="outFirstString"/>
</sequence>
</scope>
<scope name="scope-2">
<sequence>
<assign name="assign-3">
<copy>
<from variable="input" part="payload" query="/tns:CompensationTest1Request/tns:input"></from>
<to variable="inSecondString" part="parameters" query="/nsxml1:printSecondString/int_1"/>
</copy>
</assign>
<invoke name="invoke-2"
partnerLink="partnerLink"
portType="nsxml0:ReservationEndpoint"
operation="printSecondString" inputVariable="inSecondString"
outputVariable="outSecondString"/>
</sequence>
</scope>
<invoke name="callbackClient" partnerLink="client"
portType="tns:CompensationTest1Callback" operation="onResult"
inputVariable="output"/>
</sequence>
</scope>
</process>
Similar Messages
-
Compensation handler and compensate activity doesn't work
Hi!
i'm trying to build process with compensation handlers and it doesn't work .. to test it i made the following example:
in scope_1 there is simple assign_1 and in compensation handler there is assign_2. after scope_1 i throw error and in catchAll branch i have compensate activity - calling compensation of scope_1. But that compensation activity is never invoked! can please someone tell me why? what am i doing wrong?
I have bpel 10.1.2 ...
Thanks, Tomas
This is the source of my process:
<process name="pokusy" targetNamespace="http://xmlns.oracle.com/pokusy"
xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:ns4="http://xmlns.oracle.com/pcbpel/adapter/db/all_keycodes/"
xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns5="aa"
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
xmlns:client="http://xmlns.oracle.com/pokusy"
xmlns:ora="http://schemas.oracle.com/xpath/extension"
xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc">
<partnerLinks>
<partnerLink name="client" partnerLinkType="client:pokusy"
myRole="pokusyProvider" partnerRole="pokusyRequester"/>
</partnerLinks>
<variables>
<variable name="inputVariable" messageType="client:pokusyRequestMessage"/>
<variable name="outputVariable" messageType="client:pokusyResponseMessage"/>
</variables>
<faultHandlers>
<catchAll>
<sequence name="Sequence_2">
<compensate name="Compensate_2" scope="Scope_1"/>
<assign name="Assign_3">
<copy>
<from expression="concat(bpws:getVariableData('outputVariable','payload','/client:pokusyProcessResponse/client:result'),'after compensate..')"/>
<to variable="outputVariable" part="payload"
query="/client:pokusyProcessResponse/client:result"/>
</copy>
</assign>
<invoke name="Invoke_1" partnerLink="client"
portType="client:pokusyCallback" operation="onResult"
inputVariable="outputVariable"/>
</sequence>
</catchAll>
</faultHandlers>
<sequence name="main">
<receive name="receiveInput" partnerLink="client" portType="client:pokusy"
operation="initiate" variable="inputVariable" createInstance="yes"/>
<scope name="Scope_1">
<compensationHandler>
<assign name="Assign_2">
<copy>
<from expression="concat( bpws:getVariableData('outputVariable','payload','/client:pokusyProcessResponse/client:result'),'...COMPENSATE!!!')"/>
<to variable="outputVariable" part="payload"
query="/client:pokusyProcessResponse/client:result"/>
</copy>
</assign>
</compensationHandler>
<sequence name="Sequence_1">
<assign name="Assign_1">
<copy>
<from expression="concat(bpws:getVariableData('inputVariable','payload','/client:pokusyProcessRequest/client:keyCode'),'...first assign...')"/>
<to variable="outputVariable" part="payload"
query="/client:pokusyProcessResponse/client:result"/>
</copy>
</assign>
</sequence>
</scope>
<throw name="Throw_1" faultName="ns5:aa"/>
<invoke name="callbackClient" partnerLink="client"
portType="client:pokusyCallback" operation="onResult"
inputVariable="outputVariable"/>
</sequence>
</process>this might be caused by a bug I found too causing eventhandlers not to work, the work round in your case would be:
blar blar blar
</variables>
<!-- start work round --><scope><!-- end work round -->
<faultHandlers>
blar blar blar
blar blar blar
</sequence>
<!-- start work round --></scope><!-- end work round -->
</process>
i.e. what I'm saying is that top level handler don't work since they are ignored by the engine because they are not in a scope. Try it and see.... -
Human Task in Compensation Handler - Error in Compilation
Hi,
I am developing a BPEL flow in which i need to have a Human Task in a BPEL Flow's Compensation Handler.
The compiling fails saying receive from the human task has e a createInstance='no'.
If i make it 'yes' (just to check) it fails saying createInstance is already made 'yes' in the main receive which instantiates the process itself.
May I know if it is a bug? I am using Jdeveloper Studio 10.1.3.3.0.4157
Is there any workaround for this?
Thanks,
Pavan.
If not, how wldHi Anirudh,
Thanks for quick reply.
I have a requirement where based on certain condition i need to update the task and reassign it.
There is a batch that runs and performs the task. While doing so i dont have any info as to whom
the task is assigned.
So i am using bpeladmin to perform the task.
If task is assigned to user and i try to update the task using bpeladmin then am able to do so.
But if the task is assigned to Group i am getting the error. If task is assigned to user, i am able to
acquire the task but not able to update the task.
While updation it shows the task has been acquired by some other user.
Is there any other way by which i can implement the same ?
Regards,
Bhavik -
How to create a Compensation handler
Jdev 10.1.3.4
I am trying to rollback the insert statement using compensation handler.
I created a delete statement in DBAdapter and calling it from the compensation block in innerscope.
In the outer scope, I am catching the error and calling the compensation activity and i set the scope of compensation to inner scope.
when I execute the BPEL process, if the BPEL process errors out my compensation activity is not invoked.
Could somebody help me to resolve this issue?Is this XA datasource feature available in 10g Soa suite..
--Prasanna -
Problems using compensation handler in soa11g
Dear All,
I am working on soa 11.1.1.3 ,
i am having problems using compensate activity and also compensation handler inside a scope.
By what i have read on the net,i think its used to roll back a completed process.
In my case, i am making a call from process 1 to process 2 to process 3 and if any one process fails,say process 3,then i want to rollback process 3.
i have put all the 3 process inside different scopes.
Now after the completion of process 3 i used a throw activity to throw an error just to check whether compensate rollsback process 3 or not(roll back only 3 because process 3 is in a different scope and i am using compensate inside the catchall activity of process 3).But what i found was in the audit trail of the instance, process 3 status is completed and it also show's a fault has occured.
what i thought was that process3 would have been completely roll backed and the audit trail would have showed information only till process 2.
am i goin wrong some where or have i interpreted it in the wrong way!!!
Any suggestion's are most welcome!!!
Regards
Ajay.vHi,
When you use compensate activity you can only rollback successfully executed scopes and u need to write the compensation logic in the compensate handler of a scope. -
Compensation handler invoked by bpel console admin
Hello
I need to implement following scenario: bpel process generates user task with two possible conclusions: accept and reject. Process must allow bpel administrator to react on situation where user by mistake choose wrong task conclusion. Is it possible to use compensation in this scenario? Any other ideas?
Regards
JHi sreejit,
Restart your database. Probably there is some problem with the database.
or
Check your datasource connection details in EM-> JDBC connections.
Cheers,
Abhi... -
Compensation in Oracle BPEL not according to spec
Hello,
while playing around with the oracle BPEL engine and compensation I figured out, that the Oracle BPEL engine doesn't behave according to the BPEL standard as far as compensations are concerned:
The spec (http://www.ibm.com/developerworks/library/specification/ws-bpel/, S. 30) says:
"The <compensate> construct is used to invoke compensation on an inner scope that has
already completed normally.This construct can be invoked only from within a fault handler
or another compensation handler."
In fact - the BPEL Engine does invoke the scopes which have not finished as well. It does not compensate the scopes which have not been activated yet.
I assembled a running example in which I have 4 scopes: Error, Waiting, Running and Finished. The example is completely standalone - thus does not require any further webservices.
The Error-Scope triggers the compensation by throwing an exception. At that time another scope is still running and one has already finished. As your will see, the compensate after the fault invokes the compensate of the Scopes Error,Running and Finished. I had expected - that according to the specs - it should only had invoked the Finished scope.
This is what the ActiveEndpoints engine does. I compiled the sample example for ActiveEndpoint 3.1 and included it in the zip file.
The example can be downloaded at:
http://achrist.net/~a.christ/download/CompensateTest.zip
Is this behavior intended - and when - why is it not mentioned to be a derivation from the BPEL spec ?
Thanks in advance,
AndréHello!
Is there any news on this topic? I acutally experienced the same behaviour today.
My process has two service calls in parallel, each of the calls is surrounded by its own scope with compensation handlers. In the all surrounding scope I catch all faults and call both compensation handlers. The one for the faulted service call should behave like <empty>, but it doesn't and produces the next fault, as the system is unavailable.
Even worse, if the "faster" thread throws the fault the compensation for the "slower" thread is started, even though the service call in the "slower" thread hasn't even started.
I can't believe this is intended behaviour!!!
Am I missing something? Are there any workarounds? Can you please comment on this.
Thanks,
Markus -
OIM 10g Event Handler : Integrated with User Groups.User Members
I have created custom event handler and integrated it with User Groups.User Members data object.
here is my code od event handler class:
public class GroupEventHandler extends tcBaseEvent {
public GroupEventHandler() {
this.setEventName("Event Handler Sample");
protected void implementation() throws Exception {
System.out.println("============@@@@@@@@ IN EVENT HANDLER ");
try
String groupKey = this.getDataObject().getString("Groups.Key");
writeToFile(groupKey);
catch (Exception e)
e.printStackTrace();
But I am getting this exception :
ERROR [ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)' XELLERATE.SERVER - Class/Method: tcTableDataObj/getString encounter some problems: Column 'GROUPS.KEY' not found
com.thortech.xl.dataaccess.tcDataSetException: Column 'GROUPS.KEY' not found
at com.thortech.xl.dataaccess.tcDataSet.getColumnIndex(Unknown Source)
at com.thortech.xl.dataaccess.tcDataSet.getString(Unknown Source)
at com.thortech.xl.dataobj.tcTableDataObj.getString(Unknown Source)
at oim.GroupEventHandler.implementation(GroupEventHandler.java:19)
at com.thortech.xl.client.events.tcBaseEvent.run(Unknown Source)
at com.thortech.xl.dataobj.tcDataObj.runEvent(Unknown Source)
at com.thortech.xl.dataobj.tcDataObj.eventPostInsert(Unknown Source)
at com.thortech.xl.dataobj.tcUSG.eventPostInsert(Unknown Source)
at com.thortech.xl.dataobj.tcDataObj.insert(Unknown Source)
at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
at com.thortech.xl.dataobj.tcTableDataObj.save(Unknown Source)
at com.thortech.xl.ejb.beansimpl.tcGroupOperationsBean.addMemberUsers(Unknown Source)
at com.thortech.xl.ejb.beans.tcGroupOperationsSession.addMemberUsers(Unknown Source)
at com.thortech.xl.ejb.beans.tcGroupOperations_ejm77u_EOImpl.addMemberUsers(tcGroupOperations_ejm77u_EOImpl.java:1671)
at Thor.API.Operations.tcGroupOperationsClient.addMemberUsers(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at Thor.API.Base.SecurityInvocationHandler$1.run(Unknown Source)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.security.Security.runAs(Security.java:41)
at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(Unknown Source)
at Thor.API.Base.SecurityInvocationHandler.invoke(Unknown Source)
at $Proxy66.addMemberUsers(Unknown Source)
at com.thortech.xl.webclient.actions.UserGroupMembersAction.assignMemberUsers(Unknown Source)
at com.thortech.xl.webclient.actions.UserGroupMembersAction.assignGroupMembers(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at com.thortech.xl.webclient.actions.tcLookupDispatchAction.execute(Unknown Source)
at com.thortech.xl.webclient.actions.tcActionBase.execute(Unknown Source)
at com.thortech.xl.webclient.actions.tcAction.execute(Unknown Source)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at com.thortech.xl.webclient.security.SecurityFilter.doFilter(Unknown Source)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)Anyone have idea about why "Groups.Key" not found exception thrown here..
I have assigned this event handler at postinsert event of User Groups.User Members Data Object. -
Issue with using Compensation handlers
HI,
I have one main outer scope and 2 inner scopes. The first scope completes successfully but the second scope fails and throws a error.
The error is caught in the main outer scope and I call the compensation handler for the first scope. Inside the compensation handler of this scope i am invoking a BPEL prcs.
When i deploy and execute the code, the prcs runs as expected...scope 1 executes and scope 2 throws a error which is caught and comepensate activity is called.....
I checked in the audit console and it says "BPEL "compensate" activity is executed."....but inside the compensate handler i am invoking a BPEL prcs but i don't see any instance being created... How do i confirm if the compensate activity ran successfully???
Thankscan you select all the work items for that instance?
sql>select node_id,scope_id,state where cikey=?
does the audit-trail says that it executed the <invoke>? i suspect that invoke probably failed and the msg is sitting in the recovery queue. can you provide the debug log? please create a sr and upload log file & your processes. please post the sr number on this thread. -
I have a Database Adapter that insert a record. After that, if there's an error, the record must be deleted. I used compensation. Inside the compensation handler, i invoke another database adapter that delete the record. The input variable of the compensation invoke (called "compensateInput") requires two parameters, month and year. Those parameters are passed by the client, so they are in the inputVariable. But I can't assign them to "compensateInput".
I tried to create the "compensateInput" variable both as a global variable and a local variable, but with no success. I tried to put the Assign inside the scope, outside of it, everywhere, but it seems that "compensateInput" and "inputVariable" can't see each other. I think it's a scope problem.
Can you help me?
I use SOA 10.1.3.3
Thanks.You don't have to use compensation to rollback. refer to the below thread.
Re: the transaction on multiple PL/SQL Web Service on once BPEL process -
Hello,
I am using Oracle SOA suite 10.1.3 and JDeveloper 10.1.3.1 for BPEL processes.
The process I created has a 'ParentScope' that has two child scopes inside a flow activity, 'BushScope' and 'BlairScope' having individual compensation handlers.
As per the process logic activities inside the 'BlairScope' takes longer time to complete, and 'BushScope' will throw an LadenException.
This excpetion is caught by ParentScope that invokes a default compensation activity.
'BlairScope' activities are canceled in the midway. As per my understanding of the BPEL4WS 1.1 spec, compensation handlers of either scopes "Bush or Blair' should not be initialized and should not be called.
Bus when I ran a process. BPEL console showed that compensation handlers of both scopes was called.
Please help me any way it is possible.... How should I handle such a compensation situation... Am I not handling it correctly?
Are there some simple examples for similar situations....
Thanks & Regards,
GovindaHello Clemens,
Following lines are from the spec BPELWS 1.1-
"A compensation handler for a scope is available for invocation only when the scope completes normally. Invoking a compensation handler that
has not been installed is equivalent to the empty activity (it is a no-op)"
Parent scope has a primary flow activity, which contains two concurrent invoke activites inside thier indivdual scopes, Bush and Blair scopes.
Before Blair scope successfully completes, 'I' have made sure that Bush will throw an exception. Now in this case, since niether of the child scopes have completed successfully and haven't sent COMPLETED SIGNALs to parent scope, I think thier compensation handlers should not be installed.
But in this trial example, cancellation webservice operation X, inside the compensation handler of the respective childs copes is called. So, the compensation handlers are getting installed even if the scopes have not completed successfully.
I have tried both implicit and explicit compensation in the BPEL.
Thanks & Regards,
Govinda -
To implement compensate Handler in bpel?
{color:#3366ff}Hi,
I am invoking two services(i.e,service A,service B{color}) in bpel.Both of them are dealing with diff. database.Now I want to use *{color:#ff0000}compensate hander{color}* such that if one service goes down than the whole transaction should also rolled back.if any one having idea how to implement and configure compensate handler,{color:#3366ff}please let me know.
Thanks
Arvind{color}
Edited by: Avi007 on Jun 23, 2008 9:41 PMArvind,
Please post this and any component related questions in the users list of esb. [email protected]
Transactions and compensation are not one and the same. compensation is used more for compensation, meaning business "roll back". If you see your services as units of business work, compensation would take compensatory actions when one of those fails.
In your case, you seem to want to roll-back like in transactions. Then you should use transactions. Have you tried using transactions with BPEL. Try making the BPEL atomic.
If you use compensation here, you could achieve something like this through compensation handler of the second service. That would be by invoking the first service to revert the changes. But this is not as atomic as TXs provide.
So when to use TX Vs compensation handler?
It depends on use case by use case, do you want to do TXs and incur it's overhead, or is your use case happy with few dirty reads. For instance if service A is airline reservtion and service B is car reservation, these don't need to use TXs. Simple compensation would do fine. Airline tickets do get cancelled and users accept the fact that the flight was full this moment, but next day there may be a vacant seat.
hope that helps,
Kiran B. -
Hi,
I am trying to catch the remoteFault and used the catch branch and used Namespace URI as http://schemas.oracle.com/bpel/extension Local Part: remoteFault and fault Variable: faultVar.
But when assingning the faultVar is not showing its elements code, summary and details. It is weird that it is showing in some BPEL process and not showing in some BPEL process. Is something need to take care while using system fault?
Regards,
SreejitHi Sreejit,
There is often a need to use an activity that does nothing. An example is when a fault must be caught and suppressed. In this case, you can use the empty activity to insert a no-op instruction into a business process. The syntax to use an empty activity is as follows:
<empty standard-attributes>
standard-elements
</empty>
If no catch or catchAll is selected, the fault is not caught by the current scope and is rethrown to the immediately enclosing scope. If the fault occurs in (or is rethrown to) the global process scope, and there is no matching fault handler for the fault at the global level, the process terminates abnormally. This is as though a terminate activity (described in "Using the Terminate Activity to Stop a Business Process Instance") had been performed.
Consider the following example:
<faulthandlers>
<catch faultName="x:foo">
<empty/>
</catch>
<catch faultVariable="bar">
<empty/>
</catch>
<catch faultName="x:foo" faultVariable="bar">
<empty/>
</catch>
<catchAll>
<empty/>
</catchAll>
</faulthandlers>
Assume that a fault named x:foo is thrown. The first catch is selected if the fault carries no fault data. If there is fault data associated with the fault, the third catch is selected if the type of the fault's data matches the type of variable bar. Otherwise, the default catchAll handler is selected. Finally, a fault with a fault variable whose type matches the type of bar and whose name is not x:foo is processed by the second catch. All other faults are processed by the default catchAll handler.
Invoking a compensation handler that has not been installed is equivalent to using the empty activity (it is a no-op). This ensures that fault handlers do not have to rely on state to determine which nested scopes have completed successfully. The semantics of a process in which an installed compensation handler is invoked more than once are undefined.If an invoke activity has a compensation handler defined inline, then the name of the activity is the name of the scope to be used in the compensate activity. The syntax is as follows:
<compensate scope="ncname"? standard-attributes>
standard-elements
</compensate>
Hope this is much clearer and answers your question!
Cheers
Anirudh Pucha -
Compensation handlers invoked for failed activities
I am using Oracle BPEL server 10.1.2 on Windows with the Oracle lite 10G dehydration datastore.
I have fault handlers and compensation handlers for tasks in my workflow. I see that compensation handlers are being invoked for the task that hits the fault handler path. My understanding of the spec was that compensation handlers are not installed for tasks that hit the fault handler. Has this been fixed in newer version of this product?
Edited by: user10195910 on Sep 16, 2008 1:59 PMHello Clemens,
Following lines are from the spec BPELWS 1.1-
"A compensation handler for a scope is available for invocation only when the scope completes normally. Invoking a compensation handler that
has not been installed is equivalent to the empty activity (it is a no-op)"
Parent scope has a primary flow activity, which contains two concurrent invoke activites inside thier indivdual scopes, Bush and Blair scopes.
Before Blair scope successfully completes, 'I' have made sure that Bush will throw an exception. Now in this case, since niether of the child scopes have completed successfully and haven't sent COMPLETED SIGNALs to parent scope, I think thier compensation handlers should not be installed.
But in this trial example, cancellation webservice operation X, inside the compensation handler of the respective childs copes is called. So, the compensation handlers are getting installed even if the scopes have not completed successfully.
I have tried both implicit and explicit compensation in the BPEL.
Thanks & Regards,
Govinda -
Working with Transactions in BPEL PM
Hi,
I am working on the Transactions in BPEL by solving the sample (<drive>\product\10.1.3.1\OracleAS_1\samples\tutorials\122.DBAdapter\advanced\dmlInvoke\*XAInsert*) provided in Oracle SOA suite samples. In this, I have performed by taking two different datasources as mentioned in the readme.txt and I am able to acheive the transaction functionality (provided in the sample inserting into two different datasources in a single commit.). However, this transaction is rolled back to the last commit point when there is any error in Insert2Service or Insert1Service. Here the BPEL instance will disapppear since there is no persistent point for this process.
I have used the wait activity in the process before the both inserts to store the instance to the dehydration store, so whenever there is any exception I could see the instance hanging on the wait activity. It never executes any activities further the BPEL engine control is lost for this particular instance.
I would like to know whether can we catch any type of exception thrown by Adapter framework and execute the necessary error handling code in the same BPEL process. Any suggestions. Ideas are welcome. Please throw some light if any of them have done BPEL Transactions with these kind of scenarios. (I am more insterested in doing it without the compensation handler concept.)
Thanks in advamce.
Regards,
RakeshHi Anirudh,
Thank you for the quick response.
Let me give you brief exact desciption of my what I'm trying to achieve.
I have BPEL process which is performing insert operations into two different databases. I'm trying to achieve this in a single Transaction for both inserts so I have set the transaction property for both Partner Links as "Participate" which enable both the inserts to perform in single transaction. I have already included the exception handler blocks for both the DB Insert calls and also has global exception handler for my BPEL process.
But since I have set the transaction property whenever there is any exception in the second insert or in the first insert operation then BPEL control is lost, it never executes the exception block and instance is disappeared since thare is no commit point. So I have included wait activity before first Insert and now whenever there is any exception the instance rollbacks to wait activity which is the last commit point for my process and hangs there without any control and it never executes the exception block.
Please help me in this scenario how to catch the DB exception in my process and do further error handling tasks.
Let me know if you need further details.
Thanks,
Rakesh
Maybe you are looking for
-
My friend just sold me her ipad she got Jan 2013. The software says its up to date with iOS5.1.1, but when i try to download certain app it tells me I need to update to iOS6.0 or later but when i go to the setting there are no updates. so how do I ad
-
Ok, so I want to use Lightroom to create a web gallery, which is easy enough, but I would like to use a different design other than the ones provided with the software. The included templates are fine, but are a little boring and look a bit dated. A
-
DTW error 10000100 Document total value must be zero or greater than zero
I am trying to import AR service invoices and I am getting an error. I am using the Document and Document line files and I have tried several different ways but still get the same error. On the main document file I have DocNum,DocType,DocDate,DocDueD
-
Import .mov files to Elements 8
Got a new laptop with enough power to run Elements 8, but it won't import the .mov files from my Kodak Zi8 camcorder. I have installed the latest version of Quicktime. Everything I've read says Elements will work with .mov files. What am I doing wron
-
When is Adobe going to start offering ACE exams for its CS5 products?
I am most interested in getting the CS5 Web Specialist certification (Dreamweaver, Flash Pro, and either Photoshop or Illustrator). I have asked multiple departments at Adobe over the phone and even called Pearson VUE, the company Adobe outsources i