AnsweredAssumed Answered

Suspending process instance

Question asked by garuh on Oct 25, 2013
Latest reply on Oct 28, 2013 by garuh
<b>My scenario:</b>

Start -> Service task 1 -> Service task 2 -> End

Service tasks have Java delegates which runs some long time logic (ie. file processing). Because we don't want task to block transaction and we don't want to use Receive tasks, for some reasons, so I thought that I can use process instance suspend method in my java delegate:

runtimeService.suspendProcessInstanceById(execution.getProcessInstanceId()); 


Than I pass information about this process execution to some external thread:

new ProcessThread(execution.getProcessInstanceId(), execution.getId()).start();


This external thread will activate process after its job will be done, using this:

runtimeService.activateProcessInstanceById(processInstanceId);


<b>Problem:</b>

The thing is that process isn't at suspended at all. Mine service tasks are asynchronous and exclusive (I know, that's stupid), but I was expecting that when I tell Activity to suspend process instance in java delegate execution than Activity will stop processing next tasks and wait, like it is when it reaches user or receive task.

<b>Question:</b>

Is it event possible? How can I stop process execution when I wan to? Maybe I can stop job executor somehow, but is it available in java delegate?


Thank you in advance for any help.

Outcomes