0

I have three steps in my AWS environment:

  • Step 1 is synchronous
  • Step 2 is executed after Step 1 and is asynchronous that takes input from Step 1 and encodes the audio file and puts the encoded file on S3.
  • Step 3 should execute after Step 2 takes input both from Step 1 and encoded file on S3 generated in Step 2.

How should I implement this? I want to use Step functions but I have asynchronous Step 2 that I am not sure how to handle.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
user1744147
  • 1,099
  • 13
  • 30

1 Answers1

0

You can achieve it by implementing Task Activities.

An activity worker can be an application running on an Amazon EC2 instance, an AWS Lambda function, a mobile device: any application that can make an HTTP connection, hosted anywhere. When Step Functions reaches an activity task state, the workflow waits for an activity worker to poll for a task. An activity worker polls Step Functions by using GetActivityTask, and sending the ARN for the related activity. GetActivityTask returns a response including input (a string of JSON input for the task) and a taskToken (a unique identifier for the task). After the activity worker completes its work, it can provide a report of its success or failure by using SendTaskSuccess or SendTaskFailure. These two calls use the taskToken provided by GetActivityTask to associate the result with that task.

Step 3 is supposed to be an activity task. Worker invoked in step 2 will poll activity created in Step 3 and after completing its job it will report Step 3 activity using SendTaskSuccess or SendTaskFailure depending on the output of the worker.

A.Khan
  • 3,826
  • 21
  • 25
  • Why Step 3 is an activity task and not Step 2? Step 2 is asynchronous, step 3 is not. – user1744147 Mar 20 '19 at 22:14
  • One step in step functions can only use one resource. If step 2 is supposed to run an async worker job then it can not be used for activity job as well. – A.Khan Mar 20 '19 at 22:20