Worker id is null for external tasks

Hi , i created an external task at the end of the process , so that each task will be ended as an external task and i can poll those using an external agent .
But to fetch and lock the task workerId is mandatory . But i have all external tasks with ‘null’ value . So how could i identify an external task with a particular identifier ? I have the payload for fetch and lock API (http://192.168.1.188:8080/engine-rest/external-task/fetchAndLock) as follows

{
“workerId”:“aWorkerId”,
“maxTasks”:2,
“usePriority”:true,
“topics”:
[{“topicName”: “PR_request_External”,
“lockDuration”: 10000
}]
}

I have only the topic name as my custom value , but it will be same for all the external tasks in that flow .
But in this case when there are say like 5 external tasks , how could i fetch and lock and complete a particular external task ? Or its usual procedure is pollling all external tasks at once and complete it one by one using external task id ?

Hi @Muneeb_Kt,

I’m not sure I understand your problem. However, the typical interaction between client and engine is the following:

  1. Client performs fetch and lock providing a worker id
  2. Engine locks tasks for that worker and returns them as the response to the fetch and lock request (this updated the worker id field in the database)
  3. Client works on the task and completes each task individually via complete API

When executing fetch and lock, you cannot query for specific tasks unless they belong to different topics. The engine will just lock any tasks that belong to the specified topic.

Does that make sense?

Cheers,
Thorben

1 Like

Hi , yeah i got how it works from the following thread .

Thanks for your response :smile: