Camunda 8 searching for active tasks

Is it ok that after starting a process I need to wait about 5 seconds for getting a task by endpoint http://localhost:8082/v1/tasks/search ? Currently I make request to that endpoint several times to get a task otherwise the response is empty.

I do not know if the problem is related to the long-term task creation or to the task search

Can you give more details about your problem? It’s a little difficult to fully understand

I have this problem as well. I have started another topic about it:

There’s a delay after a process instance is started - Camunda 8 Topics - Camunda Forum

I use zeebe client in nodejs:
const repo = await zbc.createProcessInstance({
bpmnProcessId: “Process_06g4veu20”,
});

After that I immediately use REST API defined at Tasklist documentation in Camunda 8 with the following options:
const options = {
method: “POST”,
url: “http://localhost:8082/v1/tasks/search”,
headers: {
“Content-Type”: “application/json”,
Cookie: cookie,
},
body: JSON.stringify({
state: “CREATED”,
processInstanceKey: processInstanceKey,
}),
};

But then it returns an empty array. Only after some time(around 3-4 seconds) I get expected result

Thank you! I’m surprised that we have the same issue)

Hi @MagzhanUnited and @kristoffer.jalen, that’s correct, the current search endpoint delivers tasks only 5 seconds after creation, due to logic happening in between.

We know this is not great and hence working on a GET endpoint that returns a single task immediately after creation.

Do you need this for the query as well?
Maybe you can help to describe your use case. Is it a problem for your end users, or more an issue during development?

Also, another way to get task info in realtime is using a custom exporter (Exporters | Camunda 8 Docs), which allows to build apps in a more event-driven fashion.

In addition, we will deliver Task Listeners in 8.6, which allows you to subscribe (in your Java, Node, etc. app) to task creation as well, allowing you to skip building an exporter.

Best,
Christian,
Product Manager Tasklist