Camunda Retry Service task


I am implementing a worker that completes a service task using Camunda.Worker handler.

I want when the task is locked, to check a condition and if it is true I want to intentionally “fail” the task and re-lock it again and retry it

Can you help me?

Hi @konkouts! :slight_smile:

You can simply subtract a failed implementation from a previously defined set of retries as it is described in this section here.

1 Like

Hi @SafeAndSound
Thanks for the answer.

Currently, I implemented this functionality by adding a boundary error event on my external service task and from my app I throw a new BpmnErrorResult.

Finally I configured the error event to follow a flow back to the same service task.

It seems that I am achieving what I wanted. Is this a valid approach?

Thank you again!

Hey @konkouts!

Nice to hear that you found another solution!

In my opinion, to decide if your solution would be a valid approach or not, you should always think about - “Is this an important/relevant part from the process perspective”.

Because as the docs mentioned there is a retry-behavior you can consider in your external-task worker, but it then “hides” the actual retries of your executions. By modeling this mechanism you obviously have to add additional elements which generally lead to more complexity of the model, because there is more to look at and to understand.

So if the retry condition is based on a relevant process or business information I would go for the modeled approach to make it “visible”. If the service-task could not be completed successfully, e.g. because there was a network timeout to an external service call, I would simply log it and retry it within my service-task implementation.

Hope it helps!

1 Like


Appreciate it!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.