Executing asynchronous child workflow and retrieving result later

Hi team. I have a use case as follows: User makes a request to our service, and the requests takes a while (10-15 minutes), so we want to just return a response (like a “created” response or something to let the user know that the request was received) while the request proceeds asynchronously. As the request proceeds, we’ll need to get the status of the request

I’m thinking the best way to handle this is to have a parent workflow A spawn a child workflow B, and B can execute some Activity methods that will complete each step of the request.
Some requirements :

  • We’d need to see the status of B, and specifically see the status of each Activity method
  • Parent workflow A should start child workflow B and simply return an “OK” response while B continues

This question seemed most similar to mine, and I’d just like to know if the solution in comment 2 still stands or is there a better way to implement this?

BTW I am using Java and Spring Boot - if there are any examples of an async child workflow for this environment please let me know. Thanks

I don’t understand why you need a child workflow for this use case.

I would have a single workflow. When the request is made, the workflow id is constructed by the request handler using user ID and whatever information the service has to identify the request uniquely. Then the user can use that ID to query to retrieve the current status.

Okay, yes I see your point. So I will just call the workflow asynchronously, that way I could return immediately while the Activities continue. And then like you said I can use the ID to query the status.

1 Like