cancel
Showing results for 
Search instead for 
Did you mean: 

Suspending activiti process and continuing from task which throw exception

divya1
Champ in-the-making
Champ in-the-making
I have a requirement where if an exception occures during workflow, process will suspend and I need to start the process from where exception occurred.

What I did was I suspended process repositoryService.suspendProcessDefinitionByKey("orderWF"); changed the state of variable and re-activated the process with repositoryService.activateProcessDefinitionByKey("orderWF"); runtimeService.startProcessInstanceByKey("orderWF",processVariables);. But the problem is it starts from first but I want it to start from where task throw the exception.

Hope some one could guide me on this.
2 REPLIES 2

trademak
Star Contributor
Star Contributor
Why would you use the suspend functionality for this? It would be better to use an async task. Then the process instance will asynchronously try to complete this task. When the job retry is 0, it will stay in that state. And you can continue the process instance from there yourself.

Best regards,

divya1
Champ in-the-making
Champ in-the-making
Thanks Tijs. I followed your guidelines and created async tasks, ran waitForJobExecutorToProcessAllJobs and things are working smooth. But had one doubt I'm currently in my POC stage and running workflow from main method, but when workflow runs on a server jobExecutor will automatically pick the pending jobs and finish. Is my understanding right? A brief on when and how jobExecutor will be triggered would be great to know.