cancel
Showing results for 
Search instead for 
Did you mean: 

Suspending and Stop/Cancel activiti Process instance

neo1
Champ in-the-making
Champ in-the-making
Hello,
   Our application use Activiti v5.19.0. We need suspending/stop activiti process instance during process running.
   I know there are APIs to suspend activiti process instance, suspendProcessInstanceById(String processInstanceId) and activateProcessInstanceById(String processInstanceId). Here are my questions.
   1) Can we call API suspendProcessInstanceById in Java service task(JavaDelegate)?
   2) How does activiti suspend/re-activate process?
        For example, the process has three sequence tasks, task-1, task-2, task-3. We suspend process when process is running at task-2.
        a) Does activiti complete task-2 before suspending? Or suspending process right way.
        b) Which task will be resumed when re-activating process? Process will re-run task-2 or run task-3?
        c) Assuming re-activate is going to run task-3, in our application the task-3 is a receive task, so re-activate process instance will send signal to task-3 receive task to continue process?
    3) Is there API to stop/cancel the running process instance?

thanks,
–Haiou
  
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
1) yes.

2) a) No, the process execution is suspended. The task 2 won't be able to be completed
b) task 2 - if it's a user task.
c)  activating the process instance will continue from where the process was in the last stable state.

3) there is a deleteProcessInstance method on the RuntimeService

neo1
Champ in-the-making
Champ in-the-making
Thanks a lot.
One more question: you mentioned "b) task 2 - if it's a user task.", in our case, the task 2 is a java service task(java delegate), we will call suspend api in task-2 java service task if one of our condition is not satisfied, then activiti process is suspended. Then our application does other operation, and manually re-activate the activiti externally, does activiti re-run the task-2?

jbarrez
Star Contributor
Star Contributor
No, Activiti will finish the current transaction, execute task 2 and continue until the next 'wait state' (user task, receive task, etc.)