as per attached image when Manager rejects expense how does the workflow execution starts again from List Expense (Activity) which was previously execute.
Some ideas:
-
Write a reusable workflow function that handles the “List Expenses” to “Review” logic. Your workflow can invoke this function and then await the approval signal, if rejected can do the notification and then invoke this function again. Note that a single workflow execution in Temporal has event history count limit so in case of a large number of rejections you will need to partition event history via ContinueAsNew for example.
-
Use a child workflow. Parent workflow would invoke “Create Report” activity, then start a child workflow which would handle expenses and itself await approval signal. If approval is good it can complete, if its rejected child workflow can ContinueAsNew. Child in this case can ContinueAsNew as many times as needed, to parent it would look as a single child execution.
Can you give more info on your “List Expenses” activity as in whats the business logic of invoking it again if its not “completed”? Sounds as in this could be a polling use case instead that could be handled via single activity. This would allow you to not have to think about single workflow execution event count limit here as well.