zoukankan      html  css  js  c++  java
  • Amazon SWF Actors

    What is an Actor in Amazon SWF?

    In the course of its operations, Amazon SWF interacts with a number of different types of programmatic actors. Actors can be workflow startersdeciders, or activity workers. These actors communicate with Amazon SWF through its API. You can develop these actors in any programming language.

    The following diagram shows the Amazon SWF architecture, including Amazon SWF and its actors.

    
               The different entities or "actors" in an Amazon SWF workflow.

    Workflow Starters

    A workflow starter is any application that can initiate workflow executions. In the e-commerce example, one workflow starter could be the website at which the customer places an order. Another workflow starter could be a mobile application or system used by a customer service representative to place the order on behalf of the customer.

    Deciders

    A decider is an implementation of a workflow's coordination logic. Deciders control the flow of activity tasks in a workflow execution. Whenever a change occurs during a workflow execution, such as the completion of a task, a decision task including the entire workflow history will be passed to a decider. When the decider receives the decision task from Amazon SWF, it analyzes the workflow execution history to determine the next appropriate steps in the workflow execution. The decider communicates these steps back to Amazon SWF using decisions. A decision is an Amazon SWF data type that can represent various next actions. For a list of the possible decisions, go to Decision in the Amazon Simple Workflow Service API Reference.

    Here is an example of a decision in JSON format, the format in which it is transmitted to Amazon SWF. This decision schedules a new activity task.

     
    {
       "decisionType" : "ScheduleActivityTask",
       "scheduleActivityTaskDecisionAttributes" : {
          "activityType" : {
             "name" : "activityVerify",
             "version" : "1.0"
          },
          "activityId" : "verification-27",
          "control" : "digital music",
          "input" : "5634-0056-4367-0923,12/12,437",
          "scheduleToCloseTimeout" : "900",
          "taskList" : {
             "name": "specialTaskList"
          },
          "scheduleToStartTimeout" : "300",
          "startToCloseTimeout" : "600",
          "heartbeatTimeout" : "120"
       }
    }     

    A decider receives a decision task when the workflow execution starts and each time a state change occurs in the workflow execution. Deciders continue to move the workflow execution forward by receiving decision tasks and responding to Amazon SWF with more decisions until the decider determines that the workflow execution is complete. It then responds with a decision to close the workflow execution. After the workflow execution closes, Amazon SWF will not schedule additional tasks for that execution.

    In the e-commerce example, the decider determines if each step was performed correctly, and then either schedules the next step or manages any error conditions.

    A decider represents a single computer process or thread. Multiple deciders can process tasks for the same workflow type.

    Activity Workers

    An activity worker is a process or thread that performs the activity tasks that are part of your workflow. The activity task represents one of the tasks that you identified in your application.

    To use an activity task in your workflow, you must register it using either the Amazon SWF console or the RegisterActivityType action.

    Each activity worker polls Amazon SWF for new tasks that are appropriate for that activity worker to perform; certain tasks can be performed only by certain activity workers. After receiving a task, the activity worker processes the task to completion and then reports to Amazon SWF that the task was completed and provides the result. The activity worker then polls for a new task. The activity workers associated with a workflow execution continue in this way, processing tasks until the workflow execution itself is complete. In the e-commerce example, activity workers are independent processes and applications used by people, such as credit card processors and warehouse employees, that perform individual steps in the process.

    An activity worker represents a single computer process (or thread). Multiple activity workers can process tasks of the same activity type.

  • 相关阅读:
    $().each和$("input[name='XXX']")
    常规JS操作
    日期大小比较JS方法
    集合迭代
    技术点1
    GItHub pages 的使用方法
    node.js是做什么的?
    jQuery基础:下(事件及动画效果)
    jQuery基础:上(样式及DOM操作)
    页码demo制作
  • 原文地址:https://www.cnblogs.com/cloudrivers/p/11627814.html
Copyright © 2011-2022 走看看