JavaDelegate is not called when ServiceTask has "Asynchronous before"

I am developing standalone Java application that should call different Java tasks using JavaDelegate and make several retries if the task is failed. So for the ServiceTask I specified:

  • Asynchronous before
  • Retry Time Cycle: R3/PT3S.

I am using in memory H2 database and start ProcessInstance using:
processEngine.getRuntimeService().startProcessInstanceByKey(key, variables);

I can see that there is 1 active ServiceTask but my JavaDelegate is not called.

I can execute my job

But if some error occurs I get an exception and no retries will be done.

INFO: ENGINE-02001 Execution with id 'LoadInputTask' throws an error event with errorCode 'load_error', but no catching boundary event was defined. Execution is ended (none end event semantics).
Waiting for [MessageEntity[repeat=null, id=9, revision=1, duedate=null, lockOwner=null, lockExpirationTime=null, executionId=5, processInstanceId=5, isExclusive=false, retries=3, jobHandlerType=async-continuation, jobHandlerConfiguration=transition-create-scope, exceptionByteArray=null, exceptionByteArrayId=null, exceptionMessage=null, deploymentId=1]] jobs

I can reproduce this problem on this example:

For this purpose I have specified for ServiceTask

  • Asynchronous before
  • Retry Time Cycle: R3/PT3S.

In such case all tests are failed:

Running org.camunda.quickstart.servicetask.invocation.sync.TestSynchronousServiceTask
Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 11.333 sec <<< FAILURE!

I also checked an example with service-invocation-asynchronous:

The same problem - if I am specifing “Asynchronous before and Retry Time Cycle”, then Java class AsynchronousServiceTask is not called.

So my question is - how I should start ProcessInstance in Java application if started process contains JavaDelegates that should be retried several times?

Thank you in advance,

I understand the reason:

jobExecutorActivate Boolean Controls whether the process engine starts with an active job executor or not. For a shared process engine configuration, the default value is true. For an embedded process engine configuration, the default value is false.

So I fixed the problem:

		ProcessEngineConfiguration pec = ProcessEngineConfiguration