Don't execute complete task with rest api

I want to complete task by id. I using rest api .



It is not working. Please

I start with wokerId but it is null when running

Hi @Helen,

External tasks have a lifecycle. The happy path through the lifecycle is the following:

  1. The process reaches the task, and the engine puts the job for the external task on the queue.
  2. A worker claims this task via Fetch & Lock
  3. The same worker completes the task within the lock duration

Have you fetched and locked the task before you attempted to complete it?

1 Like

Thank you @StephanHaarmann

WorkerID is not intended to be a variable within the process, but something that is set by your client program (the worker) to identify that client program instance.
Each call that the worker makes needs to include this ID when it’s talking to the server.

Much like when you’re dealing with User tasks…
I have to claim the task (and tell the system my name when I do)
I have to complete the task (and tell the system my name when I do)

If I claim the task (with my name), and then you try to complete the task (with your name), the sytem will correctly tell you that you cannot complete the task, since I said I’m working on it.

1 Like

Hi Stephan,

How can I implement Fetch & Lock in camunda 8?

Hi @Jenneffer_Jiminit,

This is done via the ActivateJob gRPC call. This method is implemented in all client libraries. Usually, you don’t do it actively, but define a worker who performs this step periodically.

Do you have references on how to implement this using PHP?

No, I’m not familiar enough with PHP.
However, there is an outdated client, which may guide you in your development:

Alternatively, you can use one of the connectors to call your application (i.e., via rest). However, in this case, you’ll lose some control.