cancel
Showing results for 
Search instead for 
Did you mean: 

Suspend Functionality in Activiti

chandanmb1
Champ on-the-rise
Champ on-the-rise
Hi,

First of all i need to understand how suspend action works in activiti.
Assume, i have a scenario

Start -> Service Task1 -> Service Task2 ->End
Service Task 1 - counts from 1 to 1000
Service Task 2 - counts from 1001 to 2000

I am trying to suspend after the execution of Service Task 1
   runtimeService = processEngine.getRuntimeService();
        processInstance = runtimeService.startProcessInstanceByKey("suspendDelUser");
      
        When process starts, Control directly goes to Service Task 1 and then to Service Task 2 and then Ends
        AFAIK, to suspend process,
        String ProcInstanceId = processInstance.getProcessInstanceId();
        runtimeService.suspendProcessInstanceById(ProcInstanceId);
        which i am not getting.

How to suspend the process, when we are in the middle of execution of Service Task 1 (Or after completion of Service Task 1)
But it should not go to Service Task 2?
         
         


12 REPLIES 12

Hello Martin,

Also, whenever we want to pause an execution of workflow. Thread has to terminate otherwise it will consume the memory.
Whenever we resume back, then thread has to start the execution from the same state where it has got paused

jbarrez
Star Contributor
Star Contributor
"Also, whenever we want to pause an execution of workflow. Thread has to terminate otherwise it will consume the memory."

Activiti never keeps threads running nor consumes memory for suspended process instances.

Can you provide a unit test with what you're trying to do? I have a hard time following exactly what you are wanting to achieve.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

create failing jUni test similar to org.activiti.MyUnitTest#testServiceProcess

Regards
Martin