cancel
Showing results for 
Search instead for 
Did you mean: 

How to suspend current process instance ?

sudarshan
Champ in-the-making
Champ in-the-making
Hi

Have written a piece of java code (below) . but I can't see the process getting suspended in Suspend Process in Activiti explorer

RuntimeService runtimeService = execution.getEngineServices().getRuntimeService();
     runtimeService.suspendProcessInstanceById (execution.getProcessInstanceId());



Request assistance..
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
You have suspended *one* single instance. In Explorer, you shouldn't be able to complete any task of that process instance.

If you want to see the process definition suspended in Explorer, you need to suspend the process definition

sudarshan
Champ in-the-making
Champ in-the-making
Thanks for your inputs.

Going forward in new version of Activiti BPM, can we change the menu 'Suspended Process' to 'Deactivated Process',, as I personally feel current naming convention leads to ambiguity.


A question based on your inputs.

I am calling below code to suspend by the current proceess in java service task.

e.g
Activity A -> Call Java Service Task (Suspend)

Is below code correct or do you suggest any change.?.

RuntimeService runtimeService = execution.getEngineServices().getRuntimeService();
runtimeService.suspendProcessInstanceById (execution.getProcessInstanceId());

Thanks in advance.
Thanks

frederikherema1
Star Contributor
Star Contributor
Suspending the "current running process" from within the process itself might possibly not work, because the process is still "flowing" and the latest state is not yet committed in the database. I'm not 100% sure it will fail, you'll need to try. With some luck, the suspend() only updates the process-instance suspended-flag and lets the other process-changed be committed as well without error.

marwahussein
Champ in-the-making
Champ in-the-making
Hello,
I tried to suspend the current process instance with this command:

runtimeService.suspendProcessInstanceById(pi.getId());
System.out.println(pi.isSuspended());
but the last sentence returned false
I don't know why it is not suspended is there something wrong ?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Did you update pi object in the memory?

Regards
Martin