Notify entire process has completed or not

Hi Team,

I’ve created a façade API to start my process which has 3-4 tasks. is there any way to wait until entire process(4 tasks) gets completed before returning API response.

Thanks,
Phani

An easy option might be to create an contactable endpoint in your API facade that waits for a request to come back from the engine saying it’s finished.
LIke this:

1 Like

Thank you. I’m calling this below snippet from my controller class. could you please provide any reference/code snippet to handle waiting.

    ProcessInstanceEvent processInstance =zeebeClient
        .newCreateInstanceCommand()
        .bpmnProcessId(PROCESS_DISPATCH)
        .latestVersion()
        .variables(processVariables)
        .send().join();

You wouldn’t need to write any Camunda specific code for this.
Just extend your current applcation to accept an incoming REST request and Camunda 8 can then make that request using a Camunda 8 Connector.

For instance if you’re using a springboot application you could just follow this tutorial on creating a rest endpoint

1 Like

The problem is this subprocess can be called from my facade API and as well as other parent process. so ideally i will not be able to check for other incoming rest event(i mean i can’t add any other task to the existing model) . so… that’s where we got stuck. is there anyway we can handle from the background through code in the facade API like listening to processInstance etc

The other option would be to have your facade api poll Zeebe in intervals checking if the process instance has finished.

1 Like

any inbuild method to check process has finished or not? or any Zeebe API to hit

There’s an Operate API that you can use

1 Like

Hi @phani9613,

here is an example that may fit to your use case as well:camunda-8-examples/synchronous-response-springboot at main · camunda-community-hub/camunda-8-examples · GitHub

The client uses a unique job worker ID to get notified when the job with the matching topic will be activated. It uses asynchronous java programming in the client to achieve this even on a high load.

Hope this helps, Ingo

2 Likes

Thanks Ingo. will try this out.

Thanks Ingo. this reference helped us. Thanks a ton.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.