External Task : increment timeout?

Camunda : 7.7.2-ee
External Task using java API

Given an external task that could take hours, or better yet a long period of time that is difficult to estimate prior to execution, as well as this direction from the docs :

“The lock expiration duration should not be shorter than than the expected execution time. It should also not be too high if that implies a too long timeout until the task is retried in case the worker fails silently.”

Is it possible to increment the timeout interval of an external task once it is locked and “in-flight”? My thinking here is with a very long process, it would be advantageous to lock a task with a minimal lock interval, say 60 seconds, then continually increment that timeout as execution continues. It would serve as a sort of heartbeat, so if 2 hours in to a 6+ hour task, the process dies, for example with a OOM or the server goes under, a new worker could pick up the task quickly and without too much concern for task duplication or without waiting 4 hours for a retry.

I suppose my worker process could unlock and then relock the task, but that seems to be opening up the possibility of a race condition on task locking, though my current approach will be to update the camunda ACT_RU_EXT_TASK table directly. Curious if anyone has implemented or approached a problem similar to this.

It is indeed - but not in 7.7.x

A worker who claims an external task will be able to increase the time of the lock periodically via REST.

It’s a feature planned for 7.8.0, which is going to be released at the end of November. It’s currently available as part of the the 7.8.0-alpha release which you can read about here:

https://blog.camunda.org/post/2017/07/camunda-bpm-780-alpha2-released/

and you can download here:

https://docs.camunda.org/enterprise/download/

Hope that helps.

2 Likes

Yes, that is very helpful and exactly what I’m looking for! Thanks