• Used to build applications that coordinate work across distributed components. In it, a task represents a logical unit of work performed by a component of application.
  •  
  • Coordinating tasks across application requires managing
    • inter-task dependencies
    • scheduling
    • concurrency
  •  
  • SWF gives control over
  • implementing and coordinating tasks
  • tracking their progress
  • maintaining their state.
  • required to implement workers to perform tasks
  • workers can run on EC2, or on user’s premises.
  • can create long-running tasks
    • SWF
    • stores tasks
    • assigns them to workers when they are ready
    • monitors their progress
    • maintains their state, including details on their completion.

Workflows

  • used to coordinate and manage execution of activities which
  • run asynchronously
  • across multiple computing devices
  • feature both sequential and parallel processing
  • when designing a workflow, analyze application to identify its component tasks,
  • Tasks in SWF are ‘activities’.
  •  workflow’s coordination logic determines order in which activities are executed.

Workflow Domains

  • It scopes SWF resources within AWS account.
  • a domain for all components of a workflow is needed like workflow type and activity types
  • workflows in different domains cannot interact with one another.

Workflow History

  • A  detailed, complete, and consistent record of every event occurring since workflow execution started.
  • An event represents a discrete change in workflow execution’s state
  • Events can be
    • scheduled and completed activities
    • task timeouts
    • signals

Actors

  • Are programmatic feature
  • It can be
    • Workflow starters
    • Deciders
    • Activity Workers
  • actors communicate with SWF by its API.
  • can develop actors in any programming language.
  • Workflow Starter
    • is any application that can initiate workflow executions.
  • Deciders
    • logic that coordinates tasks in a workflow
    • It schedules activity tasks and provides input data to activity workers
    • It also processes events arriving while workflow is in progress and closes workflow when objective has been completed.
  • Activity Worker
    • a single computer process (or thread) performing activity tasks in workflow.
    • different activity workers process tasks of different activity types
    • multiple activity workers can process same type of task.

Amazon SWF Tasks

  • three types of tasks – Activity tasks, AWS Lambda tasks, and Decision tasks.
  • Activity Task –commands an activity worker to perform its function. Has information that activity worker needs to perform its function.
  • AWS Lamda –same as an activity task, but executes Lambda function instead of SWF activity.
  • Decision Task –commands a decider. contains current workflow history.

Task Lists

  • organize various tasks associated with a workflow
  • similar to dynamic queues
  • when a task is scheduled in SWF, specify a queue (task list) to put it in
  • During polling SWF for a task, determine which queue (task list) to get task from.
  • Task lists helps to route tasks to workers as per use case.
  • They are dynamic and no need to register a task list or explicitly create it

Long Polling

  • Deciders and activity workers communicate with SWF using long polling
  • decider or activity worker periodically
    • initiates communication with SWF
    • notify SWF of its availability to accept a task
    • specify task list to get tasks from
  • Works well for high-volume task processing.
  • Deciders and activity workers can manage their own capacity.

Workflow Execution Closure

  • Once we start a workflow execution, it is open.
  • open workflow execution can be closed as
    • completed
    • canceled
    • failed
    • timed out
  • can also be continued as a new execution, or terminated.
  • decider, person administering workflow, or Amazon SWF can close a workflow execution.

Lifecycle of a Workflow Execution

  • SWF interacts with actors by assigning them appropriate tasks either activity or decision tasks.
  • Starting from beginning of a workflow execution to its completion,
  • Below, lifecycle of order processing workflow execution from components that act on it.
Menu