I was looking at this particular sample with a view to design something similar as below:
- A workflow with a number of activities where each activity will make an outbound API call.
- Parts of the response from Activity 1 will be used as an input for the second API call (Activity 2).
We don’t have a sample that makes a rest api call to some third party services but you could implement that yourself given the api you want to use in your activity.
There is a number of examples that execute and activity sync and assign the result, for example:
var res string
err := workflow.ExecuteActivity(ctx, activities.MyActivity).Get(ctx, &res)
// use res to pass as input to your next activity execution call
// ...
- Now if due to some reason, that payload in the second Activity get a 500 response, the task should >fail and wait at that stage without failing the workflow.
- A query will be used to understand the problem.
- Then based on the payload analysis outcome, a human operator will manually fix that payload > probably via signal and/or fix the DB and then re-trigger that activity.
In case of a bad result, you could return a NewNonRetryableApplicationError from your activity and then wait for a signal with the next payload to invoke this activity with again. For the query part, see this sample.
Another options could be to poll until your receive a valid response, see this post for best practices for that.
Hope this helps you get started.