Retry behaviour for failed worker in Camunda 8

Hello Camunda team!

I would like to know how to handle retries for Camunda 8 workers?

In my scenario my worker calls external endpoint and it can be unavaliable. So I expect that my worker can try to access the endpoint let’s say in 30 seconds again and repeat this operation 2 times. After that it should fails with the incident in Oeprate.

That is possible to do using native Java code (as my worker implemented in Java using quarkus-zeebe client) but any suggestions to use Camunda tools like Retries in Task defenition on diagram or etc?

Because the main idea is to see in Operate that worker failed with the call and try it one more time. If I do retry behaviour using native Java code the worker will just stucked on execution and Operate will not show the correct current status of it so I’d like to avoid such things.

Thank you in advance!

Hi,

Can you elaborate a little bit more on the last part of your question? In operate you can always manually retry a worker by clicking the retry button.

Regards,

Maarten

Yes, in Operate we can manually but my idea is to make worker try itself, let’s say three times with a time gap beetween and only after that fail.

I found a solution here but as mentioned it doesn’t work in self-managed platform.

Thanks for the clarification. I have no idea why it does not work in the Self-managed version, so I cannot help you with that at the moment, sorry.

Regards,

Maarten

Hi @mhais,

This is controlled by the client.

To retry after a time gap of 2 minutes, just use this command:

client.newFailCommand(job)
       .retries(job.getRetries() - 1)
       .retryBackoff(Duration.ofMinutes(2))
       .errorMessage("only used when retries is 0")
       .send();

Hope this helps, Ingo

Working fine, thank you!