Setting a job's retries to 0 inside a JavaDelegate's execution


#1

Hello,

we were wondering if it’s possible to directly create an incident and not do any retries inside a task.

For example, a task can have multiple types of exceptions. If exception A occurrs then no amount of retries will let the task succeed, while a retry might succeed in case of one of the other types of exceptions. So, letting the task fail upon exception A would save some resources.

We tried creating an incident and setting the retries to 0 and 1 through the management service, but the retries-variable was overwritten afterward by the Failed Job Command Factory.

We already discussed throwing a BpmnError and letting it loop back to the task via a User Task (so a person can fix the error before retrying the task). However, while that might be a solution to our problem, it’s not really an answer to our question :upside_down_face:

Thanks


#2

Hi @busca,

I guess that the update of the retries doesn’t work because you did the update in the same transaction which was rollback afterward. So you could update in retries in a separate transaction.

However, I think the best way is to implement a custom FailedJobCommandFactory.

Does this help you?

Best regards,
Philipp


#3

Yes, thank you.