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.
managementService.createJobQuery().active().list();
I can execute my job
managementService.executeJob(job.getId())
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:
https://github.com/camunda/camunda-bpm-examples/tree/master/servicetask/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,
Fedor