AnsweredAssumed Answered

Question about Transactions

Question asked by bkwf2 on Mar 14, 2012
Latest reply on Mar 14, 2012 by bkwf2
Hi,

I am using a "Receive task" to wait for an external JVM process to complete. Once the external JVM process completes,
the external process will "signal" the wait task to proceed forward. The external process remotely talks to the Activiti WF engine. The external process has code like this:

   

getRuntimeService().setVariable(processId, "someVar", "someValue");
   
   // some more business logic takes place here.
   
   getRuntimeService().signal(executionId);

Now in the above scenario, if something goes wrong in the business logic, after the process variable is set, an exception is thrown, and "signal" is never sent. But I still
see the process variable persisted to the "ACT_RU_VARIABLE". Is there a way to elegantly rollback data changes thru a "transaction" as part of Activiti code..? Or do we need to provide our own transactions in this scenario?

To avoid the above issue, I tried to send signal like this:

   

getRuntimeService().signal(executionId, variables);

So instead of setting variables using "getRuntimeService().setVariable" before the signal is sent, I want to achieve the setting of process variables as part of the
signalling. But somehow the variables are never set in the Process scope. Am I doing something wrong..?

thx for any advice.

Bhushan

Outcomes