I am struggling to automate suspension in a BPMN model. For insolated testing, I have a simple BPMN model with a start, end, and two groovy script tasks. The first task writes a printline, “Script 1”. The second task calls sleep 45000 then prints “Sleep Complete.” Both tasks are async and exclusive. I cannot suspend the sleep process without receiving an error. Scouring the documentation and forum posts, I have tried:
- Calling PUT flowable-rest/service/runtime/process-instances/{processInstanceId}
- Calling the REST service process definition.
- Creating a second workflow containing a Service Task that calls a Java class implementing ActivityBehavior. In the execute method, get the Context RuntimeService and suspend process instance by id.
- Creating a subprocess in the workflow calling the Serivce Task above.
Each of these attempted solutions resulted in a FlowableOptimisticLockingException or a Postgresql deadlock error. Is there another way to implement process instance suspension on a running workflow? An explicit example would be helpful, if possible.