I’m using ZeebeClient to start a new process instance. While doing so I want to access the process instance variables on the whenComplete() callback of newCreateInstanceCommand(). Below is the code
While debugging I found that process instance is not yet created (or atleast not available for querying) when it reaches the whenComplete() callback. I got 404 exception when I tried to get the ProcessInstance object using processInstanceKey in the same callback. However I got the object back when I queried it after Thread.sleep(5000).
Is this an issue? If not is there any way to access the process instance variables inside whenComplete() callback?
Hi @jonathan.lukas
For some reason, I’m not using Tasklist API. Instead I have my own entity having some process/task related details (say processInstanceKey, taskInstanceKey, taskName, assignee) linked to my Business Entity. And I have an API to Iist down the tasklist combining these two entities for the current user.
I do not want to put everything which I want to show in my tasklist, as processInstance variables. So I have a bit of code which listens to various events and synchronises my process entity. This was indeed working fine with Camunda 7. But when I simulated same thing in Camunda 8, it is not working the same way.
I can understand from C8 architecture that Zeebe and Operate (& other components) are independent. However when Zeebe says I’m done, shouldn’t it be actually done from the eyes of other components as well?
However when Zeebe says I’m done, shouldn’t it be actually done from the eyes of other components as well?
The answer is no. Here, the cause is that zeebe export processed events, leading to a stream of events that is exported to Elasticsearch. From here, Operate, Tasklist and Optimize are able to use the exported data to calculate the current status of the zeebe.
As this does not happen synchronous, there is a chance that the last event was not already processed by other components, leading to a state where a state change was processed by zeebe, but the resulting event have not yet been processed.
As a workaround, you can wrap the call to Operate into a resilience framework like resilience4j.