Simpleworkflow in The Cloud: Poa June 17, 2010 Alan Robbins and Rick Sears
Simpleworkflow in The Cloud: Poa June 17, 2010 Alan Robbins and Rick Sears
Cloud
POA June 17, 2010
Alan Robbins and Rick Sears
Todays Talk
What is a Workflow?
Multi-step activity orchestration
Business logic relating those activities
Address failures and exceptions
Database
SimpleWorkflow Design
Goals
Marketplace of Cloud
Capability
Marketplace of Cloud
Capability
Anyone can offer their activities and
workflows
Document API and extension points
Include pricing plans
BUY enables access
We had an Insight!
We had an Insight!
For any workflow
Regardless of representation language
Regardless of simplicity or complexity
Even in exceptional situations
A Decider Represents a
Workflow
Workflow
History
- Events
- Inputs
- Result
Decider
(stateless function)
Decisions
SimpleWorkflow isnt
SimpleWorkflow
Architecture
SimpleWorkflo
w
Activity Workers
while true {
Poll for Activity Task (long poll)
<execute business activity, script, or
program>
Respond Completed (with Result) or Failed
}
Activity Workers
while true {
Poll for Activity Task (long poll)
<hand off task to a website or other app>
}
Respond Completed (with Result) or Failed
Decider
while true {
Poll for Workflow Task (long poll)
<apply decider logic: History Decisions>
Respond Completed (with Decisions) or
Failed
}
Decider is Open
Many innovative
implementation approaches:
Decider Framework [available now]
Annotations Framework
xPDL Interpreter
Asynchrony
?
<domain specific languages>
Worker Protocols
Advantages of polling
Downsides of polling
A lot of work for nothing
To reduce latency, clients aggressively poll
Runtime Infrastructure
Runtime Infrastructure
WF State
Persistence
Task
Synchronization
Scheduling &
Queuing
Timeout
Management
Task Routing
Versioning
Access/Permissio
ns
Monitoring/Metri
cs
Metering and
Billing
Audit Trail
Archival
Console
Simple API
Workflow Instances
Start
Signal
TryCancel
Terminate
Visibility of Instances
List, Describe,
GetHistory
Access/Permissions
Get/SetPolicy, Associate
Decisions
Schedule Activity
TryCancel Activity
Record Split/Join
Complete Signal
Complete Workflow
Takeaways
Workflows are multi-step asynchronous
capabilities which may be very long lived
Workflows are ubiquitous
You probably have them if you know it or not!
Two Approaches
Choreography
Orchestration
Choreographies
Participants
coordinate actions
between one another
Everyone must know:
Where to look?
Whom to tell?
How to handle the
unexpected?
How to report status?
Item Processing
Pipeline
Orchestrations
Actions coordinated
by centralized
decision maker
Workers only need
to know:
How to do their job
How to communicate
Centralized status
and failure handling
Apollo deployment
SWFs Role
Both are valid approaches
Recognized need for support for
orchestration approach
SWF acts as auditable coordinator
between:
Decider acting as orchestrator
Activity workers performing specific jobs
Getting Started
Next Steps
Connect Decider
SimpleWorkflo
w
Decider
(stateless function)
Workflow
History
Decisions
Kick it off!
Design Patterns
Famous GOF patterns for designing software
Covers common practices in a language
agnostic way
Building blocks of application logic
Some examples:
Creational
Singleton, Factory Method
Structural
Faade
Behavioral
Visitor
Workflow Patterns
Common practices for building multi-step
applications
Building blocks for orchestrating applications
Some examples:
Control
Sequence, Parallel Split, Synchronization,
Data
Data-based Routing, Scope Data,
Exception Handling
Deadline Expiry,
Resource
Retain Familiar,
More Information
Patterns collected and documented
by a team lead by Professor Wil Van
Der Aalst and a team lead by
Professor Arthur ter Hofstede.
More details at:
www.workflowpatterns.com
Control Patterns
Sequence
Structured Loop
Exclusive Choice with Simple Merge
Parallel Split with Synchronization
Persistent Trigger
Sequence
Sequence
Start
A1
A2
A3
Close
Start
A1
SimpleWorkfl
ow
A2
A3
Close
History
WorkflowInstanceStarted
WorkflowTaskScheduled
StartWorkflowInsta
nce
Start
A1
A2
Close
History
SimpleWorkfl
ow
PollForWorkflowTas
k
A3
WorkflowInstanceStarted
WorkflowTaskScheduled
Respons
e
Start
A1
A2
A3
Close
Decisions
SimpleWorkfl
ow
RespondWorkflowTaskCom
pleted
Schedule A1
History
WorkflowTaskCompleted
ActivityTaskScheduled
A1
Start
A1
A2
Close
Activity
Task
SimpleWorkfl
ow
PollForActivityTa
sk
A3
Input_1 = FOO
Respons
e
History
ActivityTaskScheduled
A1
ActivityTaskStarted A1
A1
Start
A1
A2
A3
Close
Result
SimpleWorkfl
ow
RespondActivityTaskCompl
eted
Datum_1 = FOO
History
A1
ActivityTaskStarted A1
ActivityTaskCompleted
A1
WorkflowTaskScheduled
Structured Loop
Structured Loop
n
Start
A1
A2
A3
Close
Start
A1
A2
Respons
e
A2
Close
History
SimpleWorkfl
ow
PollForActivityTa
sk
A3
ActivityTaskScheduled
A2
ActivityTaskStarted A2
Start
A1
SimpleWorkfl
ow
RespondActivityTaskCompl
eted
A2
A2
A3
Close
Start
A1
A2
Close
History
SimpleWorkfl
ow
PollForWorkflowTas
k
A3
Respons
e
ActivityTaskStarted A2
ActivityTaskTimedOut A2
WorkflowTaskScheduled
Start
A1
A2 (2)
A3
Close
Decisions
SimpleWorkfl
ow
RespondWorkflowTaskCom
pleted
Schedule A2 (2)
History
ActivityTaskStarted A2
ActivityTaskTimedOut A2
ActivityTaskScheduled
A2
Start
A1
A2 (2)
A3
Close
History
SimpleWorkfl
ow
PollForActivityTa
sk
Respons
e
A2
ActivityTaskStarted A2
ActivityTaskTimedOut A2
ActivityTaskScheduled
A2
ActivityTaskStarted A2
Start
A1
A2 (2)
A3
Close
Result
SimpleWorkfl
ow
RespondActivityTaskCompl
eted
Datum_1 = FOO
History
A2
ActivityTaskStarted A2
ActivityTaskCompleted
A2
WorkflowTaskScheduled
Start
A1
History
ActivityTaskStarted A2
ActivityTaskTimedOut A2
ActivityTaskScheduled A2
ActivityTaskStarted A2
ActivityTaskCompleted A2
WorkflowTaskScheduled
A2 (2)
A3
Decisions
Schedule A3
Close
a
Start
A1
A2
A3
Close
A4
Start
A1
A2
Respons
e
A2
Close
History
SimpleWorkfl
ow
PollForActivityTa
sk
A3
ActivityTaskScheduled
A2
ActivityTaskStarted A2
A4
Start
A1
A2
A3
Close
Result
SimpleWorkfl
ow
RespondActivityTaskFail
ed
FAULT_DETAILS = FOO
History
ActivityTaskStarted A2
ActivityTaskFailed A2
WorkflowTaskScheduled
A2
A4
Start
A1
A2
Close
History
SimpleWorkfl
ow
PollForWorkflowTas
k
A3
Respons
e
ActivityTaskStarted A2
ActivityTaskFailed A2
WorkflowTaskScheduled
A4
Start
A1
A2
A3
Close
Decisions
SimpleWorkfl
ow
RespondWorkflowTaskCom
pleted
Schedule A4
History
ActivityTaskStarted A2
ActivityTaskFailed A2
ActivityTaskScheduled
A4
A3
Close
A2
A1
Start
A3
Close
A2
History
SimpleWorkfl
ow
PollForWorkflowTas
k
WorkflowInstanceStarted
WorkflowTaskScheduled
Respons
e
A1
Start
A3
Close
A2
Decisions
SimpleWorkfl
ow
RespondWorkflowTaskCom
pleted
Record Split
Schedule A1
Schedule A2
History
WorkflowTaskCompleted
SplitRecorded
ActivityTaskScheduled A1
ActivityTaskScheduled A2
A1
Start
A3
Close
A2
History
SimpleWorkfl
ow
PollForActivityTa
sk
Respons
e
A1
SplitRecorded
ActivityTaskScheduled A1
ActivityTaskScheduled A2
ActivityTaskStarted A1
A1
Start
A3
Close
A2
History
SimpleWorkfl
ow
PollForActivityTa
sk
Respons
e
A2
ActivityTaskScheduled A1
ActivityTaskScheduled A2
ActivityTaskStarted A1
ActivityTaskStarted A2
A1
Start
A3
Close
A2
Result
SimpleWorkfl
ow
RespondActivityTaskCompl
eted
Datum_1 = FOO
History
A1
ActivityTaskStarted A1
ActivityTaskCompleted
A1
WorkflowTaskScheduled
A1
Start
A3
Close
A2
History
SimpleWorkfl
ow
PollForWorkflowTas
k
Respons
e
ActivityTaskScheduled A1
ActivityTaskScheduled A2
ActivityTaskStarted A1
ActivityTaskStarted A2
ActivityTaskCompleted A1
WorkflowTaskScheduled
A1
Start
A3
Close
A2
Decisions
SimpleWorkfl
ow
RespondWorkflowTaskCom
pleted
History
ActivityTaskStarted A1
ActivityTaskStarted A2
ActivityTaskCompleted A1
WorkflowTaskScheduled
WorkflowTaskStarted
WorkflowTaskCompleted
A1
Start
A3
Close
A2
Result
SimpleWorkfl
ow
RespondActivityTaskCompl
eted
Datum_1 = BAR
History
A2
ActivityTaskStarted A2
ActivityTaskCompleted A2
WorkflowTaskScheduled
A1
Start
A3
Close
A2
History
SimpleWorkfl
ow
PollForWorkflowTas
k
Respons
e
ActivityTaskCompleted A1
ActivityTaskCompleted A2
WorkflowTaskScheduled
A1
Start
A3
Close
A2
Decisions
SimpleWorkfl
ow
RespondWorkflowTaskCom
pleted
Record Join
Schedule A3
History
ActivityTaskCompleted A1
ActivityTaskCompleted A2
WorkflowTaskCompleted
JoinRecorded
ActivityTaskScheduled A3
Persistent Trigger
Persistent Trigger
Start
A1
Wait
A2
Close
Signal workflow
Complete signal
Schedule activity with delay
Cancel activity
Start
A1
Wait
Close
History
SimpleWorkfl
ow
PollForWorkflowTas
k
A2
Respons
e
ActivityTaskStarted A1
ActivityTaskCompleted A1
WorkflowTaskScheduled
Start
A1
Wait
A2
Close
Decisions
SimpleWorkfl
ow
RespondWorkflowTaskCom
pleted
History
WorkflowTaskCompleted
ActivityTaskScheduled
Wait
Start
A1
SimpleWorkfl
ow
SignalWorkflowInsta
nce
Wait
A2
Close
History
ActivityTaskScheduled
Wait
SignalRecorded
WorkflowTaskScheduled
Start
A1
Wait
Close
History
SimpleWorkfl
ow
PollForWorkflowTas
k
A2
Respons
e
ActivityTaskScheduled Wait
SignalRecorded
WorkflowTaskScheduled
Start
A1
Wait
A2
Close
Decisions
SimpleWorkfl
ow
RespondWorkflowTaskCom
pleted
Complete Signal
Cancel Wait
Schedule A2
History
WorkflowTaskCompleted
SignalClosed
ActivityTaskCancelTried
Wait
ActivityTaskCanceled Wait
ActivityTaskScheduled A2
Start
A1
History
ActivityTaskStarted Wait
ActivityTaskCompleted
Wait
WorkflowTaskScheduled
Wait
A2
Close
Decisions
Many more
Multi-Choice
Workflow Data
Direct Distribution
Suspension-Resumption
Cancelling Discriminator
Cancel Region
Explicit Termination
Selection Autonomy
Capability-Based Distribution
Multiple Instances with a Priori Run-Time
Knowledge
Task Postcondition - Data Existence
Decider Framework
Provides direct support for many
patterns
Build workflows by composing
scoped deciders
Simple set of components combine
to express complex workflows
Composing Deciders
Workflow
Sequence
Split/Join
Activity
A1
Start
A1
A2
Activity
A2
A3
Activity
A3
Close
Provided Decider
Implementations
WorkflowDecider closes/fails workflow and input/result
ActivityDecider controls single activity execution and
retries
SequenceDecider sequence of deciders
SwitchDecider one of the set based on condition
SplitJoinDecider parallel execution of deciders
WhileDecider loop with precondition
DoWhileDecider loop with postcondition
TryCatchFinallyDecider exception based error handling
WaitForSignalDecider blocks execution until signal
received
DelayDecider delays execution of a decider
RetryDecider retries execution of a decider in case of
failures
ConditionDecider conditionally executes a decider
Links
Patterns:
www.workflowpatterns.com
Wiki:
w.amazon.com/?SWF
Email:
[email protected]
[email protected]
[email protected]
Contact-us
Takeaways
Steps to build and execute workflows
using SimpleWorkflow
Workflow patterns are useful
conceptual design tools
SimpleWorkflow has the capabilities
necessary to express many workflow
patterns
Frameworks are available to make your
job easier
Thanks!
SWF Team
Rodrigo De Castro
Drew Gochenaur
Maxim Fateev
Jacques Thomas
Andy Kotlinski
Fatih Boyaci
Pat Maguire
Srikanth Satyanarayana