cancel
Showing results for 
Search instead for 
Did you mean: 

cancel an workflow

luisalves00
Champ in-the-making
Champ in-the-making
hello,

It is possible to stop (cancel) and workflow??

person 1  ——–requestApproval——->  person 2

requirement:
person 1 need to cancel the Approval UserTask before the approval…
10 REPLIES 10

luisalves00
Champ in-the-making
Champ in-the-making
think this method should do the trick:

deleteProcessInstance(java.lang.String processInstanceId, java.lang.String deleteReason)
          Delete an existing runtime process instance.

is there a way to know which  process are "stale"?

lars_b
Champ in-the-making
Champ in-the-making
Hey,

I think to delete the workflowinstance works only for your given example, the "approver" process with user-tasks.

I think for any other example (where scripts and services are called) there has to be a compensation event defined in the BPMN process definition, to undo the actions already carried out…  But this is outside the workflow-engine capability atm. (correct me if i am wrong)

Lars

luisalves00
Champ in-the-making
Champ in-the-making
<>

luisalves00
Champ in-the-making
Champ in-the-making
thks lars.b,

regarding to:

I think for any other example (where scripts and services are called) there has to be a compensation event defined in the BPMN process definition, to undo the actions already carried out… But this is outside the workflow-engine capability atm. (correct me if i am wrong)

Found out this issues yesterday…

I'm using JPA…after an approver (On a user task) approve the request…edit my DB on 3 service tasks.

PROBLEM:

   IF i get an exception on the second service task, I get back to the userTask (and that's great), but on the first service task I've already committed stuff to the DB so I have to "manually" rollback.

frederikherema1
Star Contributor
Star Contributor
Hi,

Are you using spring? Is the JPA on the same datasource as activiti? If so, you could leverage Spring's PlatformTransactionManager and the TransactionAwareDataSourceProxy we use to have JPA and Activiti commit on the same connection…

When using multiple datasources and transactions, it's always tricky, not just in Activiti.

luisalves00
Champ in-the-making
Champ in-the-making
hi frederikheremans,

I'm not using spring…and using diferent datasources. So it has to be a "manual" rollback Smiley Indifferent

frederikherema1
Star Contributor
Star Contributor
That's not really an activiti-specific problem, more a general problem (cross-resource transactions). Ideally, XA transactions should be used (if both DS's support this). The only other option I see is to add custom interceptors to the interceptor-stack of the command-context activiti uses internally, to allow you to do some logic (rollback eg) when exception/rollback occurs…

matthiasn
Champ in-the-making
Champ in-the-making
Hi there, I am running into a somewhat similar problem. I would like to be be able to terminate an instance from the runtime but allow it to shut done in a controlled manner by using a service task (or a sequence of steps) to undo actions that the instance has performed. I cannot use transactions here. Ideally I would like to define what the instance should do upon entering the end state. Is there any way to do this in activiti?

Thanks,
Matthias

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
using an event listener that listens for the "process end" event might be an option