Each workflow in our system produces a final output value – typically an S3 file or a simple JSON payload. When a workflow completes, we want to post that final output to a registered callback. Similarly, we have a status API which consumers can query to also get the status and final results of completed workflows.
In the case of an S3 file, we need to generate a presigned URL for the file so external consumers can access it. The logic for this lives in a QueryMethod (getFinalResult) on the workflow class.
The status controller retrieves the execution status and uses the describe workflow execution response to determine if the workflow has completed, and if so, it calls the getFinalResult query method. I wanted to reuse this logic for the callback notification activity. However, the workflow isn’t completed at the time the activity is triggered.
Given that, my questions are:
What is a good way of handling this? I tried creating a child workflow and having it query the parent workflow for the execution status, but the parent workflow is still “running”. Can you complete the parent workflow and start a child workflow so the execution status would work?
If the above is possible, is there a problem with using the describe workflow execution method? Is there a possibility that temporal hasn’t seen the updated status at the time the child workflow would run? I wasn’t sure if those were synchronous processes or not.