Reputation: 2461
I have seen some slideshow about how one can resume a paused step functions state machine using a token. I looked through the API docs to figure out how to do this myself but could not. How exactly is the token used to find the paused state machine and which API is used to continue it?
Upvotes: 1
Views: 2861
Reputation: 1231
The closest thing I can think of is activity (https://docs.aws.amazon.com/step-functions/latest/dg/concepts-activities.html) however that requires creating a worker. Activity token which is then received (GetActivityTask
) can be used to resume state machine later (SendTaskSuccess
or SendTaskFailure
).
However I can think of a way to solve this without using additional worker (so you wouldn't need to create some always-working task): create parallel state which has two tasks:
GetActivityTask
and sends it somewhere (for example - start external process which will later resume state machine)State machine would look like this:
WaitForResume
would be task with activity and PullToken
would call GetActivityTask
. Keep in mind however that inside PullToken
you can get token for any execution of that state machine, not the actual execution. PullToken
should also have configured retry policy to solve potential issues with race conditions. Note that this is only optimization to reduce costs - straightforward way is to have additional activity worker.
Upvotes: 1