How to disable retries of Extenal Tasks that time out?

Hi

When using External Tasks and calling “fetchAndLock” a mandatory parameter in the REST API is “lockDuration”. After this time Camunda will unlock the External Task (so the task won’t fail silently and it will be available again for execution).

Is there a way to either:

  • mark this task as failed after the timeout instead of automatically unlocking it (this is a not requested retry)
  • execute an alternative flow after the timeout (this could i.e. send a notification about the timeout)
1 Like

Hi @albex,

you have different ways to solve this. You can

  • mark the task as failed and set retries to 0
  • mark the task as failed and send a BPMN error
  • using a timer boundary event on the external task

The last option is more robust and still works if the worker of the external task is not able to send a response.

Does this help you?

Best regards,
Philipp

1 Like

Yes. I guess the timer boundary solution is the only one applicable in may case.
Just want to be sure I haven’t over overlook something.

Thanks Alex

I was wondering how to know if the task timed out?
For example based on your suggestion - task times out and I want to set retries to (retries-1) - how that can be done?
Would you be able to give example of pseudo code which roughly describes how to implement it?

The timer solution assumes that the external task started i.e. if the external task client is off/unavailable the timer will go off anyway even though no fetchAndLock has taken place. Is there any other way to ensure that a task is not retried/assigned to another worker that specifically takes into consideration whether or not fetchAndLock was called?