I would like to suspend an synchronous running process instance if I encounter some error to give admin some time to rectify the error and then he can resume the process instance using its id.
I am trying to suspend a running process instance from java delegate class but it does not seem to suspend.
Below is my code -
public class Generate_DT_PS_CCS implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
String pid =execution.getProcessInstanceId();
System.out.println("supending the instance - process id " +pid);
runtimeService.suspendProcessInstanceById(execution.getProcessInstanceId());
}
}
Is there any issue in suspend the synchronous service task in Camunda?
You can not interact with your processInstance through the runtimeService API if your processInstance has not been saved to the database. That's why it is always a good practice to make the start event async, then you can be sure that there is an entry in the db. So this is not an issue of suspension.