Parts of an Amazon SWF Application

An Amazon SWF application comprises various logical elements. Understanding these will help you determine how to build your own flow applications.


A domain is an identifier (name) that you create to hold workflow processes and data. When you register a workflow type or activity type, you associate it with a domain name, in which all of the workflow activity takes place. Workflows and activities can only communicate with workflows and activities that exist within the same domain, and task lists that are used within a domain are distinct from task lists that exist in a separate domain, even if the task list has the same name as one that is being used in the other domain.

When you register a 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 within that domain.

Registering a domain is optional—The AWS Flow Framework for Ruby provides a default domain, FlowDefault, which it uses for workflow executions that are started without specifying a domain name to use. The default domain has a retention period of 7 days.

To learn how to register and deprecate domains, see Registering a Domain.


A workflow is the primary element in all Amazon SWF applications. It represents a sequence of steps required to perform a specific task. The steps needn't be strictly sequential; a workflow can consist of tasks that run sequentially, in parallel, synchronously or asynchronously. How your workflow behaves depends largely upon your business logic—the steps that are required to complete a process.

Because workflows contain code that responds to events that are managed by the Amazon SWF service, making decisions about what steps to take and how workflow execution proceeds, a workflow is also commonly referred to as a decider. Workflows are also responsible for passing data from and to any activities and child workflows that it runs.

The AWS Flow Framework for Ruby provides a default decider for you, so for simple, sequential workflows, you may not need to write any workflow code yourself. For a very simple example of a AWS Flow Framework for Ruby application that uses a default decider, see the Hello World topic.

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

  • 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.
  • 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: the registered workflow type controls the default options that will be applied to the workflow when it's run.


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, in response to decision tasks received from the workflow's task list.

See Implementing Activities to learn how to implement activities with the AWS Flow Framework for Ruby.

Task Lists#

A task list is a logical entity used by Amazon 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.


Workflow and Activity workers are responsible for receiving tasks from Amazon 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.

With the AWS Flow Framework for Ruby, you can start workers using the ActivityWorker and WorkflowWorker classes, or by using the aws-flow-ruby command-line utility to spawn a number of workers when provided with activity and workflow classes.

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

For more information about starting workers, see Starting Workflow and Activity Workers.

Workflow Execution#

A workflow execution refers to an individual execution of a workflow using a workflow_client's WorkflowClient#start_execution method (or by any other means, such as starting a workflow from the command line or using the AWS Management Console).

Once you begin executing a workflow, your workers will begin receiving task events from Amazon SWF.