Running multiple worker services for same type in zeebe

Hi,

can a single service task(x) be picked via two separate job handlers of the same task(x)?

According to the documentation (and discussion on here on the forum), a job worker is expected to pick up all the jobs up to their maximum. This means that if you have 2 jobs workers, both looking for the same task type, and there are 3 tasks available…

If the WorkerMax (can’t remember the exact configuration item…) is >= 3, then Worker1 picks up all the jobs, and Worker2 picks up none. Worker2 then begins a back-off strategy, so it starts to poll less. This can result in one worker getting all the jobs all the time.

If the WorkerMax is < 3, then Worker1 will pick up WorkerMax jobs, leaving the rest in the queue. Worker2 then polls, finds work to do, and grabs up to WorkerMax jobs. This can result in jobs still being left in the queue.

An individual task will be “claimed” by one of the workers, so no other worker will work on it at the same time. However, if the claim expires before the worker finishes the task, then a second worker could also claim the task and start working on it.
In this scenario, while your worker task is working on the job, they should periodically send “refresh claim” requests back to the Camunda server. This tells the server that the worker is still alive, and that no other worker should begin working on the task.

Does that help?

2 Likes

To clarify this point: you can’t refresh a claim.

The job activation timeout is sent in the ActivateJobs request and once that expires, the broker will allow the job to be activated by another worker.

The first worker can still complete the job on the broker, in which case the second worker will receive an error when it tries to complete the job.

Thus, the semantic is at-least-once for job activation.

Josh

1 Like