Keith Yager
Fabled Bits Web Development

Fabled Bits Web Development

Amazon Simple Workflow Service

Amazon Simple Workflow Service

Using workflows to handle your data processing

Keith Yager's photo
Keith Yager

Published on Aug 12, 2021

3 min read

Subscribe to my newsletter and never miss my upcoming articles

Amazon Simple Workflow Service, or Amazon SWF for short, makes it easy to create applications that coordinate work between multiple components.

You can think of SWF as a flowchart, and each step in the flowchart is a different activity that you create workers for to complete those activities. Your workers can complete these activities sequentially, or in parallel with other activities.

Domains

Each workflow that you create is scoped within a domain (not to be confused with a domain from a dns). A domain can have multiple workflows, but workflows cannot work between multiple domains.

Actors

As mentioned earlier, activity workers process the activities, but there also exists workflow starters and deciders. Collectively these are called Actors, and can be created by you using any programming language that you are comfortable with. Actors communicate with one another using the SWF API.

It's not necessary to know how to use the API for the exam, but it's useful to know how to manipulate workflows using it. If you wish to learn more about the API you can read the official Amazon SWF API Documentation .

Starters

Starters are basically the actor that initiates the workflow. Example starters are someone submitting an order on an e-commerce website, or somebody submitting an image to be transformed.

Deciders

Deciders handle walking through the workflow. They determine how an activity should be processed, either sequentially, parallel, synchronously, or asynchronously, and when. They also handle sending any relevant data to the workers, and when the workflow should be completed, or mark as failed.

Workers

Workers are the threads of your application that processes the activities in your workflow. Multiple workers can work on the same activity, and when a worker is finished with it's current activity, it waits for a new task to be sent to it by a decider via polling.

Tasks

The types of activities workers and deciders get depends on the type of task assignment it receives from Amazon SWF. There are three types of tasks that can be given: activity tasks, lambda tasks, and decision tasks.

Activity Tasks

Activity tasks basically tells the worker to perform any processing or other functions it should do, such as charging a credit card, performing image manipulation, or sending a notification. All information the worker needs to complete the activity is stored in the task that it receives.

Lambda Tasks

Lambda tasks tell your worker to run a Lambda function from AWS Lambda.

Decision Tasks

Decision tasks are for your deciders, and inform the deciders when the workflow starts, changes, and when an activity should be started or completes.

Task Lists

Task lists function like a queue of multiple tasks. They are created automatically as your actors receive more tasks and do not need to be explicitly created.

SWF Objects

Amazon SQF Objects can be identified by it's workflow, activity, tasks, and execution.

Execution Process

Workflows start in an open state, and can be closed as either completed, cancelled, failed, or timed out. Each execution can be sent to another workflow or terminated as needed, this is handled by the decider.

Summary

Amazon SWF provides you with a consistent workflow for your data processing needs, it can simplify your application logic and help it be more robust by ensuring your data is handled in the correct order as needed.

AWS has a useful sample workflow you can get started with to get a feel for how Amazon SWF functions, and it's worth giving it a run so you can become more familiar with SWF and watch a workflow in action.

 
Share this