Retry task

Hi,

I’m thinking to make a POC about retries to call external services, like a mail server…

I read this Error Handling | docs.camunda.org but i think it is too"heavy" for a simple retry. I make it in java but, I think this retry must be implemented in the modeler somehow like a variable in a task but I don’t found any like that.

Is it possible to do it as I thought?

Best Regards,

Ignacio

What does your mail server failure look like?

Do you want this error to perform a “catch” and do something, or you want the error to trigger a incident and rollback to previous save point?

I want something like that:

while (true) {
try {
//MAKE SOMETHING
break;
}catch(Exception e) {
count++;
if(count>maxTries) {
throw new Exception(“Something”);
}else {
TimeUnit.MINUTES.sleep(1);
}
}
}

But if is possible to configure for each external call without making a boundary error event with timer etc…

If it isn’t possible i make it java, but I’m looking for a way to make it easy if possible with the bpmn

So you could do this with both the incidents and a business error event. by default camunda will try the activity a total of 3 times. This means if you throw a error it will attempt another 2 times.

If you want more control, you can use hte business error or use a gateway.

if you look at: https://medium.com/@stephenrussett/throwing-bpmn-errors-with-javascript-in-camunda-c678f4b7d9ff and instead of pointing to a user task in a error event, you can point to a gateway that decides what the count it as per your code above

1 Like

Is this a configurable variable?

@Ignacio_Requena_Elvi https://docs.camunda.org/manual/7.9/user-guide/process-engine/the-job-executor/#retry-time-cycle-configuration

1 Like

Thx I was searching something like that but i didn’t found it :slight_smile: it’s perfect

@Ignacio_Requena_Elvi if you want to do some monitoring of your failures and success, take a look at: https://github.com/StephenOTT/camunda-prometheus-process-engine-plugin

1 Like

It looks very very interesting, I was searching plugins like that thanks for the help, has been very useful :slight_smile: