Step Functions now support callback features to support manual approval. I wanted to know how the task token is generated and if we can pass our own task token string so that we do not require to store it for marking task passed/failed.
Also, for a workflow that requires multiple client interactions for proceeding to the next state, is it recommended to use Step Functions or SWF (and its signals).
USECASE: I have multiple steps in workflow where we need to execute fail scenario if the timer reaches 6 months or if in those 6 months, user actually approves, then the workflow needs to execute to passed scenario.
AWS Step Functions generates the task token for you when you use any of the service integration patterns that support the .waitForTaskToken
integration. You can't generate your own token and pass it in as part of the integration. See the Wait for a Callback with Task token documentation for more information and examples.
For a workflow that requires multiple client interactions before proceeding to the next state, I'd personally use a Step Functions workflow. If the client interactions happen in a defined order, then I'd simply write a series of .waitForTaskToken
style service integrations that happen in serial, where each integration would then allow the next client interaction to happen (in whatever way is appropriate for what you're building, e.g. executing Lambdas, putting items in an SQS Queue, etc). However, if the client interactions can happen in any order and you want to basically pause the state machine until they're all done, I would consider delegating all of the monitoring of for the related client interactions into an Activity and just transition to that Activity's task to wait for the Activity to report back with a sendTaskSuccess
call or a timeout if they didn't all finish in the time you'd want them to.