Task waiting on external service to complete

Hi everyone,

This is my scenario: I have a task using the REST Connector to send data to an external service, which then processes the data and return some output. My issue is that the external service might take some times (up to 5 minutes) to produce such output.

What I would like to know is: is there a way to freeze the process in Bonita or to define a task that go on with the execution only when the external service returns the output? If so, what would be the best approach to define such a task? Can I somehow define a task waiting on some sort of external input?

I'm using Bonita BPM Community Edition version 7.5.2

Thanks in advance. Best

If the call to your external service immediately returns but the actual processing on the service side is taking 5 minutes the best option is probably to ask the service to callback Bonita when the production of the output is done.

In your process design you can add a human task that you will assign to a user created for your external service. In your external service you can make the REST API call to Bonita to: authenticate, list pending task for your service user in Bonita (make sure to pass the process instance id to your service and to use it when listing pending tasks) and execute the pending task.

Also if you are using Bonita 7.8, instead of using this workaround with the human task, you can use a BPMN receive message event and use the newly available API to send the message from your service to Bonita.

Thanks for the answer! The workaround makes indeed sense, I will try that out.

I also though of another possibility: send the reqeust to the external server and instead of waiting on answer finish the process. When the external server is ready to return date, somehow start a second process to process the returned date. I'm thinking the second process having a start message triggered by the external server (via API). Or using the same workaround (the second process with a human task, which is triggered by the external service).

I will experiment around. Thanks for the help!

Best

Yes your solution make sense as well. You can use a regular start even and no human task by simply calling the API to instantiate a process: /API/bpm/process/:processId/instantiation