Our usecase is need to invoke custom service(another simple BPM for performing some business checks) before every service task bigin. So we are trying to implement the flow such that
start → User Task → Start task (here added execution listener[event=‘start’] to suspend current process and trigger child process) → Another service task(same child process as previous task) → end.
When we suspend the current process instance in execution listener, process goes to suspension_state, but tasks are still in active state. After child process completion, when we try to activate suspended process, getting below error.
Cannot set suspension state ‘active’ for task … ’: already in state ‘active’.
PS: Child process flow is
start → service task → end (here added execution listener[event=‘end’] to resume parent process)
Suspend using API
CommandContextUtil.getProcessEngineConfiguration().getRuntimeService().suspendProcessInstanceById(execution.getProcessInstanceId());
Process activation using below API
CommandContextUtil.getProcessEngineConfiguration().getRuntimeService().activateProcessInstanceById(execution.getVariable(“parentProcessInstanceId”).toString())