Synchronous behaviour in Camunda 8

Hi Team,

We are migrating from Camunda 7 to Camunda 8.
We have One API - Create Process which is used to Create Process Instance and as part of API response we need to send back the the Active User task back as response, which will be used by UI to show the screen accordingly.

In the above example when Create Process API is called, we should create process instance for the workflow, execute initialize app service task and wait in User task Login screen. As part of response we should send process instance key and LoginScreen User task Name.

Response will be something like this -
{
“processInstancekey” : “123456”,
“UserTaskName” : “LoginScreen”
}

In Camunda 7, this can be achieved since its embedded engine and when we start process instance it’ll execute service tasks and execution will be moved to user task and then only response is returned.

Can this behaviour be achieved in Camunda 8?

Note - For completing userTask, UI will call another API call which process instance key and UserTask name.

Hey @Naveen_KS,
Camunda 8 has a gRPC API for starting the process and a graphQL API for Tasklist.
On start of the process you should be able to obtain the processInstanceID. Once you have done so you can run a query on the graphQL API to see whether a task has been created. You can then fetch it and obtain its key. :slight_smile:

Does this make sense?

P.S.: Some docu

Hi @Hafflgav

Yes it does return ProcessInstanceID, but there is delay in TaskList API since it uses elastic search exporter to read the data. There is a delay of 500ms to export data from zeebe broker to elastic search. It takes more than 1 second to read data from tasklist.

Again the problem for us is, we need to send Task details as part of create process response.
If Zeebe broker has not activated the User task before sending the response of Create Process API, then we can’t send Active Task details back as part of response since at that time Process instance state might not have reached User task.

Ahh I see:
So you need to have the task details basically immediately after it…
That might be something more challenging. The only alternative which does not include some “waiting” is to maybe try and consume the event stream of Zeebe…
But I cannot guarantee whether this would be working…

Hi @Naveen_KS,

here is an example how to get a synchronous response from the process instance start: camunda-8-examples/synchronous-response-springboot at main · camunda-community-hub/camunda-8-examples · GitHub

You can apply it to a user task if you have your own worker to handle the first user task.

Hope this helps, Ingo

2 Likes

Hi @Ingo_Richtsmeier,
In the example you have shared, there we are creating one temporary worker that is added in the model, when that worker is activated only, we are sending the response.

But in my case, it is not just with create process API call, for each subsequent update Process API which is used to complete the User task, I need the details of next User task which will be activated.


In the above example, Once I call update API to complete first user task Login Screen, I should send the response back with next User task " Home Screen".

Hi @Naveen_KS
This seems to be a continuation of your discussion here

You need to separate your thinking between your front-end tasks and the Camunda tasks.

Camunda does not send back to the user application “The next task is…” your UI will need to poll Camunda and determine if there is a task for the user to do.