for activities with “asyncBefore = true” it is possible to specify the retry behaviour. Only after the max tries have failed will the engine create an incident.
Is it possible, inside a JavaDelegate, to get the number of tries left until the engine will vreate an incident? How?
Probably too late but here is what I used successfully:
Note: ManagementService is ProcessEngine’s ManagementService.
managementService.createJobQuery().activityId(<your activity Id here>)
.processInstanceId(<your process instance id here>).singleResult().getRetries();
How you can get activity Id and Process Instance Id from within the delegate?, here is how:
Replying to an old thread, so hopefully someone’s still awake
@fml2 I try to do the same, but all I get is the number three (3) even though I’ve set a pattern of R5/PT10S on the service task. Executing it works as expected and the incident is created. But like you, I want to prevent that and take a different route in the process.
This happens both on the JobExecutorContext and ManagementService (as @Hammad_Dar suggested). Also casting the DelegateExecution to a ExecutionEntity (like some examples prescribe) comes up empty.