AWS Simple Workflow Service (Amazon SWF)学习笔记

Amazon SWF makes it easy to build applications that coordinate work across distributed
components.

When using Amazon SWF, you implement workers to perform tasks.These workers can run either on cloud infrastructure, such as Amazon EC2, or on your own premises.

Workflows

Using Amazon SWF, you can implement distributed, asynchronous applications as
workflows.

Workflow Domains

Domains provide a way of scoping Amazon SWF resources within your AWS account.

Workflow History

The workflow history is a detailed, complete, and consistent record of every event that
occurred since the workflow execution started.

Actors

Amazon SWF consists of a number of different types of programmatic features known as actors.Actors can be workflow starters, deciders, or activity workers.
A workflow starter is any application that can initiate workflow executions.
Activities within a workflow can run sequentially, in parallel, synchronously, or
asynchronously.
The logic that coordinates the tasks in a workflow is called the decider.The
decider schedules the activity tasks and provides input data to the activity workers.
An activity worker is a single computer process (or thread) that performs the activity tasks in your workflow.

Tasks

Amazon SWF provides activity workers and deciders with work assignments, given as one of three types of tasks: activity tasks, AWS Lambda tasks, and decision tasks.
Each decision task contains a paginated view of the entire workflow execution history.

Long Polling

Deciders and activity workers communicate with Amazon SWF using long polling.

Lifecycle of a Workflow Execution

在这里插入图片描述
Amazon SWF workflow illustration

  1. A workflow starter calls an Amazon SWF action to start the workflow execution for an order, providing order information.
  2. Amazon SWF receives the start workflow execution request and then schedules the first decision task.
  3. The decider receives the task from Amazon SWF, reviews the history, and applies the coordination logic to determine that no previous activities occurred. It then makes a decision to schedule the Verify Order activity with the information the activity worker needs to process the task and returns the decision to Amazon SWF.
  4. Amazon SWF receives the decision, schedules the Verify Order activity task, and waits for the activity task to complete or time out.
  5. An activity worker that can perform the Verify Order activity receives the task, performs it, and returns the results to Amazon SWF.
  6. Amazon SWF receives the results of the Verify Order activity, adds them to the workflow history, and schedules a decision task.
  7. The decider receives the task from Amazon SWF, reviews the history, applies the
    coordination logic, makes a decision to schedule a Charge Credit Card activity task with information the activity worker needs to process the task, and returns the decision to Amazon SWF.
  8. Amazon SWF receives the decision, schedules the Charge Credit Card activity task, and waits for it to complete or time out.
  9. An activity worker activity receives the Charge Credit Card task, performs it, and returns the results to Amazon SWF.
  10. Amazon SWF receives the results of the Charge Credit Card activity task, adds them to the workflow history, and schedules a decision task.
  11. The decider receives the task from Amazon SWF, reviews the history, applies the
    coordination logic, makes a decision to schedule a Ship Order activity task with the information the activity worker needs to perform the task, and returns the decision to Amazon SWF.
  12. Amazon SWF receives the decision, schedules a Ship Order activity task, and waits for it to complete or time out.
  13. An activity worker that can perform the Ship Order activity receives the task, performs it, and returns the results to Amazon SWF.
  14. Amazon SWF receives the results of the Ship Order activity task, adds them to the
    workflow history, and schedules a decision task.
  15. The decider receives the task from Amazon SWF, reviews the history, applies the coordination logic, makes a decision to schedule a Record Completion activity task with
    the information the activity worker needs, performs the task, and returns the decision to
    Amazon SWF.
  16. Amazon SWF receives the decision, schedules a Record Completion activity task, and waits for it to complete or time out.
  17. An activity worker Record Completion receives the task, performs it, and returns the results to Amazon SWF.
  18. Amazon SWF receives the results of the Record Completion activity task, adds them to the workflow history, and schedules a decision task.
  19. The decider receives the task from Amazon SWF, reviews the history, applies the
    coordination logic, makes a decision to close the workflow execution, and returns the decision along with any results to Amazon SWF.
  20. Amazon SWF closes the workflow execution and archives the history for future
    reference.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值