Service task gets retried after ~6 Min, even 1st execution is in running state

I believe the short answer is no: if the lock-time-in-millis is exceeded, the job can be picked up by the job executor again, which leads to a new instance of the same task.

The long answer is: there are many ways of handling this. Let’s take the example that you gave: polling from an external service on a regular interval until it gets desired output from the external service. Without claiming that the following list is complete, here are some options:

Option 1: Model the Task as Technical Process Model

You can make the repeated polling and the interval part of your models. Make the task a call activity and link a process model such as the following:

Option 2: Continuations

Continuations allow that one job picks up the work where the previous job stopped. In Camunda, you can do this by setting and retrieving process variables in your long-running jobs. This way, multiple task instances are created, but they may know about each other.

Option 3: External Task Worker / Rest API

You can use external task workers / the REST API instead of java delegates. External task workers can explicitly extend the lock. This would effectively prevent multiple task instances.

1 Like