Life Cycle of an Amazon SWF Workflow Execution
From the start of a workflow execution to its completion, Amazon SWF interacts with actors by assigning them appropriate tasks, either activity tasks or decision tasks.
The following diagram shows the life cycle of an order-processing workflow execution from the perspective of components that act on it.
Workflow Execution Life Cycle
The following table explains each task in the preceding image.
Description |
Action, Decision, or Event |
---|---|
1. The workflow starter calls the appropriate Amazon SWF action to start the workflow execution for an order, providing the order information. |
|
2. Amazon SWF receives the start workflow execution request and then schedules the first decision task. |
WorkflowExecutionStarted event and DecisionTaskScheduled event. |
3. The decider receives the task from Amazon SWF, reviews the history, applies the coordination logic to determine that no previous activities occurred, 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. |
PollForDecisionTask action. RespondDecisionTaskCompleted action and ScheduleActivityTask decision. |
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 ChargeCreditCard activity task with the information the activity worker needs to process the task, and returns the decision to Amazon SWF. |
|
8. Amazon SWF receives the decision, schedules the ChargeCreditCard activity task, and waits for it to complete or time out. |
|
9. An activity worker that can perform the ChargeCreditCard activity receives the task, performs it, and returns the results to Amazon SWF. |
|
10. Amazon SWF receives the results of the ChargeCreditCard 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 ShipOrder 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 ShipOrder activity task, and waits for it to complete or time out. |
|
13. An activity worker that can perform the ShipOrder activity receives the task, performs it, and returns the results to Amazon SWF. |
|
14. Amazon SWF receives the results of the ShipOrder 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 RecordCompletion activity task with the information the activity worker needs to perform the task, and returns the decision to Amazon SWF. |
|
16. Amazon SWF receives the decision, schedules a RecordCompletion activity task, and waits for it to complete or time out. |
|
17. An activity worker that can perform the RecordCompletion activity receives the task, performs it, and returns the results to Amazon SWF. |
|
18. Amazon SWF receives the results of the RecordCompletion 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. |
|