Non-transactional delegate?


#1

I have a delegate like one below and expect to have 5 new process instances started - suddenly no new instances have been spawn. I notice that all new processes started in a delegate are being executed only upon delegete completed. Indeed, ‘another-process’ has camunda:asyncBefore="true"

@Bean(name = "delegate")
public JavaDelegate delegate() {
    return execution -> {
        for (var i = 0; i < 10; i++) {
            execution
                    .getProcessEngineServices()
                    .getRuntimeService()
                    .startProcessInstanceByKey("another-process");

            if (i == 5) {
                throw new RuntimeException("xxx");
            }
        }
    };
}

Can somebody explain or give an example how start a new instance no waiting until delegate completes?

Thanks!