Amazon SWF Application Components

Understanding the Amazon SWF application logical elements will help you determine how to build your own flow applications.

 

Workers

Workers work with AWS to get task, process received tasks and return results. The Workflow and Activity workers are responsible for receiving tasks from SWF and in taking appropriate actions to start a workflow or schedule an activity to be run. They are each configured with a task list to poll on.

Your workers will not begin receiving workflow or activity task events until a workflow execution is started.

 

Workflows (Deciders)

A workflow is the primary element in all SWF applications. It represents a sequence of steps required to perform a specific task. A workflow can consist of tasks that run sequentially, in parallel, synchronously or asynchronously.

Workflows code responds to events managed by SWF service, making decisions about what steps to take and how workflow execution proceeds. They control coordination of tasks such as ordering, concurrency and scheduling according to the application logic. Hence a workflow is also referred to as a decider.

Workflows are also responsible for passing data from and to any activities and child workflows that it runs.

 

A workflow consists of two parts: a workflow type registration and a workflow implementation:

  1. When you register a workflow, you provide a name, a version, and a set of options that provide default settings. These settings are applied by default to any workflow that uses the same workflow name and version.

  2. The workflow implementation consists of the code that provides your business logic. This is the part of the workflow that is specifically referred to as the decider. Workflow code is associated with a workflow type registration, but you can use the same code for different workflow types.

 

Activities

An activity represents a step, or single unit of work, in a workflow. An activity can calculate a value based on input data, receive input from a web application, wait for a human task to be completed, or perform any other action that represents a step in your workflow.

Similar to workflows, an activity consists of an activity type registration, uniquely identified by a name and version and which provides default options, and an activity implementation which provides the code that will be executed when the activity is run.

Activities are scheduled by a workflow implementation (decider), in response to decision tasks received from the workflow's task list.

 

Task Lists

A task list is a logical entity used by SWF to manage events for your workflows and activities. When you register a workflow or activity, you can provide it with a task list name that can be referred to in order to receive tasks for that workflow or activity.

Workflow and activity tasks are polled for separately, even if they use the same task list name. Workflow tasks, for example, are delivered only to pollers that exist within your workflow code, and activity tasks are delivered only to your activities.

 

Domains

When you register a workflow type or activity type, you associate it with a domain name. A domain is an identifier (name) that you create to hold workflow processes and data. Workflows and activities can only communicate with workflows and activities that exist within the same domain.

You can register a domain from AWS management console or using RegisterDomain action in SWF API. When you register domain, you provide it with a workflow retention period, which is the minimum number of days that workflow history is retained for closed workflow executions. Parameters for registration are specified as JSON. Registering a domain is optional.

 

Additional Notes (Exam Tips)

  1. Workers and deciders can run on cloud infrastructure such as EC2, or even on machines behind firewalls.

  2. AWS stores tasks, assign them to workers and monitors their progress. AWS ensures that a task is assigned only once and is not duplicated.

  3. AWS maintains applications state. Workers and deciders don’t have to track the state. They can run independently and scale fast.

  4. The AWS Flow Framework for Ruby provides a default decider for you.

  5. Maximum workflow period is 1 year and value is measured in seconds.

  6. SWF offers a task-oriented API whereas SQS offers a message-oriented API.

    1. Consider factors such as human interaction, duration etc. when deciding between SWF and SQS in exam.

Learn Serverless from Serverless Programming Cookbook

Contact

Please first use the contact form or facebook page messaging to connect.

Offline Contact
We currently connect locally for discussions and sessions at Bangalore, India. Please follow us on our facebook page for details.
WhatsApp (Primary): (+91) 7411174113
Phone (Escalations): (+91) 7411174114

Business newsletter

Complete the form below, and we'll send you an e-mail every now and again with all the latest news.

About

CloudMaterials is my blog to share notes and learning materials on Cloud and Data Analytics. My current focus is on Microsoft Azure and Amazon Web Services (AWS).

I like to write and I try to document what I learn to share with others. I believe that knowledge is useless unless you share it; the more you share, the more you learn.

Recent comments

Photo Stream