Camunda 7 migration to 8

Hi all ,
I’m currently working on migration camunda 7 springboot application to camunda 8 . using camunda 7 adapter .
i’m starting the process using zeebe client and in my bpmn model i have a service task then user task so i call tasklist api to complete the user task . it sometimes work and sometimes gives me that there’s no user task as the service task is not being completed yet but the call to tasklist api happens anyway .
can anyone help me with this and give me maybe resources to work with camunda 7 delegates migration . ?
because this task was destroying my life for weekss :smiling_face_with_tear:
note : i’m using self managed camunda 8

Hi @yhamed,

how are your service task completion and your call to Tasklist API connected?

Can you share a code example here?

As Camunda 8 is completely asynchronous, it is hard to predict, when the user task will be available in the Tasklist.

Hope this helps, Ingo

Thank you @Ingo_Richtsmeier so much for replying!

this is a sample of my bpmn


and this is how I start the process
` final ProcessInstanceResult processInstanceResult =
zeebe
.newCreateInstanceCommand()
.bpmnProcessId(processId)
.latestVersion().variables(variables)
.withResult()// to await the completion of process execution and return result
.send()
.join();
long key=processInstanceResult.getProcessInstanceKey();

  return key; `

In my Java delegate, I am currently setting a variable. After starting the process and receiving the returned processInstance key, I retrieve the user tasks using the Tasks Search REST API. Then, I obtain the key of the user task and complete it using the tasks/complete API.

The problem I’m encountering is that sometimes the API returns the user task, while other times it indicates that there is no user task yet, likely because the service task has not finished its job.

I face a similar issue when attempting to retrieve variables using the Operate REST API. The API is called before the variable is set from the delegates.

If this is a wrong way, can you assist me with how to do what I want to?
This is really important, and I spent a lot investigating with this.

Thank you!

or can you assist me with how to connect the service task completion and the call of the APIs?

This is a distributed, asynchronous architecture.

Use polling, and do not assume synchronous execution.

Thank you @jwulf for your help

I start understanding and implementing pooling solution .
but I have same issue or I missing something
I start with this

and in the code i start the process normally then the process instance wait on the message catch event i publish the message right before the calling to Complete task API but there’s still a lag and the task isn’t available in the tasklist at this time , it is available after the API is called .

can you please explain how to use the message catch event and when to publish the message before calling the complete REST API ??