I am using Camunda 7 embedded process engine (Spring Boot app). In this example, the primary process does not activate the user task ( End process) until the non-interrupting event subprocess completes its work. Both the primary and subprocess work concurrently but the user task (End process) is not created until the subprocess completes. The First service call sets the var i.e. execution.setVariable(“sendAuditEvent”, ‘startProcess’); and activate non-interrupting event subprocess Send Event. Subprocess is the long-running task (Delegete Expression, ${loggerDelegate}. The BPMN diagram and loggerDelegate Java class is uploaded to this topic:
test_process.bpmn (6.6 KB)
@Component
public class LoggerDelegate implements JavaDelegate {
private final Logger LOGGER = Logger.getLogger(LoggerDelegate.class.getName());
public void execute(DelegateExecution execution) throws Exception {
LOGGER.info("LoggerDelegate invoked by "
+ "processDefinitionId=" + execution.getProcessDefinitionId()
+ ", activtyId=" + execution.getCurrentActivityId()
+ ", activtyName='" + execution.getCurrentActivityName() + "'"
+ ", processInstanceId=" + execution.getProcessInstanceId()
+ ", businessKey=" + execution.getProcessBusinessKey()
+ ", executionId=" + execution.getId());
int checkCount = 0;
do {
checkCount++;
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new IllegalStateException("Error starting new process, InterruptedException" + e.getMessage());
}
}
while (1000 * checkCount < 100000);
}
}