cancel
Showing results for 
Search instead for 
Did you mean: 

Activate and Suspend a process instance.

mahajanankur
Champ in-the-making
Champ in-the-making
I am suspending a process instance manually by using "runtimeService.suspendProcessInstanceById(processInstanceId);" .

Now I have two questions on this.

1. Lets say I have a process having 5 service tasks and I am suspending this instance at 3rd service task so according to the documentation            this process instance should be halted at 'third' service task. But it shouldn't do that, It still run the 'fourth' and 'fifth' service tasks even It has been suspended at 'third'. WHY ANY CLUE?

2. If I am trying to activate this instance by "runtimeService.activateProcessInstanceById(processInstanceId);" . It throws an "ActivitiObjectNotFoundException" exception.

Please help me on this. Any help would be highly appreciated.


3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

1. Lets say I have a process having 5 service tasks and I am suspending this instance at 3rd service task so according to the documentation this process instance should be halted at 'third' service task. But it shouldn't do that, It still run the 'fourth' and 'fifth' service tasks even It has been suspended at 'third'. WHY ANY CLUE?
If you make the service tasks asynchronous, isSuspended  flag is taken into account org.activiti.engine.test.api.runtime.ProcessInstanceSuspensionTest#testJobNotExecutedAfterProcessInstanceSuspend
2. If I am trying to activate this instance by "runtimeService.activateProcessInstanceById(processInstanceId);" . It throws an "ActivitiObjectNotFoundException" exception.
I would say process instance is already finished that's why it can not be found.

Regards
Martin

mahajanankur
Champ in-the-making
Champ in-the-making
Hi Martin,

I've tried with asynchronous too but no luck. I changed all my service tasks to asynchronous and then follow the above process but still It doesn't stop at the point where I suspending this process.

One more thing If a process instance is suspended can we activate it later, If yes
Does It starts from the step where it got suspended or It starts from first step?

Regards,
Ankur Mahajan

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Ankur,

the provided cases are described in the org.activiti.engine.test.api.runtime.ProcessInstanceSuspensionTest
Regards
Martin