Search code examples
amazon-web-servicesaws-step-functions

How to send TaskSuccess to the right activity with AWS Step Functions?


So, I'm working on a state machine. It can have up to 20 or 30 executions of it running at the same time, with different parameters.

One of it's states is an activity worker (needs to wait for some input from another step function execution started from one of it's states through a lambda function, since you can't directly start a new execution from a state machine).

I know how to send a "Task Success" for an activity. But how can I make sure it's sent to the right execution ?


Solution

  • Using a pub/sub service such as mqtt would be useful here.

    1. Generate a UUID in the lambda that spawns the new execution.
    2. Pass the UUID to the new execution and return it to the activity worker.
    3. The new execution writes the UUID and result to the queue once it's done.
    4. The activity worker reads from the queue and uses the UUID to find the right message.