How to get the result(process variables) of a completed/almost process instance ?

In my Scenario, I need to collect certain process variables before the instance complete.
However,I did not find any hook to add a callback. How can a do this ? thanks

Hello @MoseChen ,

for Camunda 8, you can use the Operate API to collect process variables.

If you want to push the results of your process somewhere, you could also use a message end event.

I hope this helps

Jonathan

1 Like

Hi Lukas @jonathan.lukas ,

thank for you reply.
Actually, I’m using Zeeb to find a common way by which I can create a new REST api without any new code, but only some process orchestration action.

In my plan, the process itself is the business logic of the ‘new orchestrated REST api’. When received a request, my service will create a process instance of the specific process model. At the end of the process instance, my service should be able to collect the process variables and transform/merge those variables as the result value of the ‘new orchestrated REST api’. Saw a similar scenario under Camunda7(https://forum.camunda.io/t/start-process-instance-and-capture-the-end-result-of-the-process/20970)

From above, we can see that my service need to be notified/called once the instance to be completed.
Further more, workaround(e.g. add a ‘message throw events’ as the last node of the process) is not what I expected.

Btw, I found in Zeebe java client,there is a class of ‘CreateProcessInstanceWithResultCommandImpl’ corresponding the the Zeebe Api(gRPC): CreateProcessInstanceWithResult, seems be able to solve my problem. Unfortunately, this implementation is not exposed by the ZeebeClient:

Hi @MoseChen

It is .withResult() as one of the builder steps for the Java Zeebe Client.

This is not “before the process completes”, however. It is very much when the process completes.

Josh

2 Likes