Getting data from process instance

Hello,
I’m starting a process from Java :

public Parameters request(Parameters parameters) {

   ZeebeClient client = ZeebeBrokerProvider.getClient();

   final WorkflowInstanceEvent wfInstance = client.newCreateInstanceCommand()
           .bpmnProcessId("my-process")
           .latestVersion()
           .variables(parameters.asMap())
           .send()
           .join();

   final JobWorker firstStep = client.newWorker()
           .jobType("first-step-service")
           .handler(new FisrtStepServiceHandler())
           .open();


   final JobWorker secondStep = client.newWorker()
           .jobType("second-step-service")
           .handler(new SecondStepServiceHandler())
           .open();

//get status and some variables back when ended

   return null;

}

I would like for program to wait until instance has finished and then get variables from this instance. Is that achievable using Zeebe? How can I do that?
Cheers,
Mateusz

@mpawlowski right now I would recommend to query Elastic Search (if you are using the ElasticSearch exporter) for such information. I wouldn’t expect the Brokers to give you such information.

HTH

Hey,

there is a new feature available, in the latest alpha releases, which makes this for short running instances possible.

this PR adds this functionallity.
Docs workflow creation by deepthidevaki · Pull Request #3470 · camunda/zeebe · GitHub this PR adds documentaton for this feature.

Alternatively you could use the hazelcast exporter to be triggered on specific events, instead of using this feature and not querying elastic.

Hope that helps.

Greets
Chris

2 Likes

Thanks again.