SWF (Simple Workflow Service)

  • In SWF the task is assigned only once and never duplicated.
  • SWF coordinates work across distributed application components.
  • It helps in implementing complex business processes and work flows.
  • It is suitable for long running execution and not for short batch jobs etc.
  • Enables complex interaction within different application on different platform, AWS or on-premise infrastructure and between different users.
  • Maximum work flow can be 1 year and it is measured in seconds.
  • Features of SWF
    • Tasks executed with no duplicate
    • Routing and queueing of the task handled by the SWF.
    • It also provides timeout and status of the task.
    • The task workflow can have child process, and a list of hierarchy process.
    • It handles user data Input and execution result output.
  • SWF components
    • A workflow is control flow logic for execution of the task.
    • A domain contains of workflow or workflows.
    • Tasks can be performed by executable code, a webservices call or end user input. They can be performed parallel or serially.
    • Actors interact directly with SWF to coordinate tasks.
  • SWF Actors
    • Actors can be workflow starter, decider or activity workers
    • Starters can initiate the execution of work flow.
    • Deciders implement work flow logic and notify SWF changes during the workflow execution
    • Activity Workers perform activity tasks of the workflow.   
  • SWF Task
    • Must be registered using either the console or the RegisterActivityType action (API/CLI).
    • When scheduled you can specify a task list (queue)
    • Decision and Activity task has separate lists (queue)
    • Task can be assigned to activity workers through task routing if required.
  • Application communication can be established to SWF through,
    • SDK
    • SWF API HTTP POST
    • Flow Framework (Java or Ruby)
    • CLI
  • SWF and SQS
    • SWF presents a task oriented API and SQS offers a message oriented API
    • SWF ensures that the task is assigned only once and never duplicated, with SQS you may get duplicate message and you will need to ensure that a message is process only once.
    • SWF keeps tracks of all the tasks and events in an application, in SQS we should implement our own application level tracking especially if the application uses multiple queues.