External Task : change retry on lock timeout

Hi,

I was wondering how to decrease the retry if external task was executor for too long and was overtaken by another camunda external task handler?

Example:

  • camunda 1 starts - fetch and lock available tasks every minute
  • camunda 2 starts - same as above
  • external task 1 is created and send to topic external topic 1
  • camunda 1 fetches task 1 and locks for 30 seconds
  • task 1 takes 45 seconds and lock was exceeded
  • camunda 2 fetches and takes over task 1 (because lock time was exceeded)

At this stage I would like to decrease retry for external task by one, it is possible to do using complete/handleFailure but how camunda 2 can know that task 1 was already executed and failed because of the execution time was exceeded?

As I understand there is no way to implement system wide external task execution listener which could intercept such event?

Regards,
Adam.

Hi @abednarski79

This is a great question, thanks for asking.
One solution is to use the Extend Lock call from worker1. If it’s still running and approaching the end of the lock it can extend it.
You could also decided to Unlock the task from worker1 if it’s taking too long. This would let worker2 pick it up without any fear of it being run at the same time by worker1