Post on 23-Dec-2015
Introduction to Windows Introduction to Windows Workflow FoundationWorkflow Foundation
Silvano Coriani Silvano Coriani (silvano.coriani@microsoft.com)(silvano.coriani@microsoft.com)
Developer EvangelistDeveloper EvangelistMicrosoftMicrosoft
AgendaAgenda
What is Windows Workflow What is Windows Workflow Foundation?Foundation?
Architecture & Core conceptsArchitecture & Core concepts
Building WorkflowsBuilding Workflows
Introduction to ActivitiesIntroduction to Activities
Workflow StylesWorkflow Styles
Workflow Authoring ToolsWorkflow Authoring Tools
Runtime servicesRuntime services
Workflow communicationsWorkflow communications
Workflow Software ChallengesWorkflow Software Challenges
““Orders are Orders are confirmed in confirmed in
48 hours and shipped 48 hours and shipped within 30 days”within 30 days”““Most suppliersMost suppliers
confirm our orders confirm our orders but some forget and but some forget and we need to followup”we need to followup”
““What is the status of What is the status of this order and what is this order and what is
the next step?”the next step?”
Long Running and Long Running and StatefulStateful
Workflows Workflows runrun for up to for up to 30 days and must 30 days and must
maintain state maintain state throughoutthroughoutFlexible Control FlowFlexible Control Flow
Flexibility for people Flexibility for people to override or skip to override or skip
steps in the workflowsteps in the workflow
TransparencyTransparencyRendering runtime state Rendering runtime state within a visualization of within a visualization of
the workflow control the workflow control flowflow
Real World BehaviorReal World Behavior Software ChallengesSoftware Challenges
Why Workflow Technology?Why Workflow Technology?
Workflows are Workflows are long running and statefullong running and stateful
Workflows must provide Workflows must provide transparencytransparency
Workflows require Workflows require flexible control flowflexible control flow
Developer ProductivityDeveloper Productivity
Workflows technology provides abstractionsWorkflows technology provides abstractions
convenient to describe real world scenariosconvenient to describe real world scenarios
Workflow software challengesWorkflow software challenges
A ISV developer building A ISV developer building a line of business a line of business application chooses to application chooses to use Windows Workflow use Windows Workflow Foundation Foundation withinwithin the the business logic of their business logic of their application.application.
An enterprise customer An enterprise customer uses BizTalk Server to uses BizTalk Server to provide system workflow provide system workflow acrossacross their existing line their existing line of business applications of business applications and trading partners to and trading partners to reduce their cycle-times reduce their cycle-times and increase business and increase business visibility in a high-volume visibility in a high-volume environment.environment.
Microsoft’s Workflow Strategy is …Microsoft’s Workflow Strategy is …
to provide Windows to provide Windows Workflow Workflow Foundation as a Foundation as a part of the part of the developer developer framework for framework for WindowsWindows
and enterprise and enterprise applications that applications that build on top of build on top of Windows Workflow Windows Workflow Foundation for Foundation for specific scenarios.specific scenarios.
For
For
Exam
ple
Exam
ple
For
For
Exam
ple
Exam
ple
Windows Workflow FoundationWindows Workflow FoundationDeliver best-in-class workflow platform & Deliver best-in-class workflow platform &
tools for Microsoft products and tools for Microsoft products and partner/customer ecosystempartner/customer ecosystem
Single workflow technologySingle workflow technology for Windows for WindowsAvailable to all customers of WindowsAvailable to all customers of WindowsAvailable for use across a broad range of scenariosAvailable for use across a broad range of scenarios
Redefining workflowRedefining workflowExtensible framework & API to build workflow centric Extensible framework & API to build workflow centric productsproductsOne technology for human and system workflowOne technology for human and system workflow
Take workflow Take workflow mainstreammainstreamIncremental learning for mainstream .NET Incremental learning for mainstream .NET developerdeveloperFundamental part of the Office “12” value propositionFundamental part of the Office “12” value propositionStrong workflow partner & solution ecosystemStrong workflow partner & solution ecosystem
What is a workflow?What is a workflow?
A set of A set of activitiesactivities that coordinate people that coordinate peopleand / or software...and / or software...
EscalateToManagerExample activities…. Example activities…. CheckInventory
Like a flowchart…. Like a flowchart….
……organized into some form of organized into some form of workflowworkflow..
Or a state diagram…. Or a state diagram….
Workflow Scenario SpectrumWorkflow Scenario Spectrum
ParticipantsParticipants: people, roles: people, roles
Flow style:Flow style: flexible, flexible, dynamicdynamic
Data:Data: unstructured, unstructured, documentsdocuments
Participants:Participants: apps, services apps, services
Flow style:Flow style: prescriptive, prescriptive, protocolsprotocols
Data:Data: structured, transactional structured, transactionalInformation Worker• Document Review…Information Worker• Document Review…
System WorkflowSystem WorkflowHuman WorkflowHuman
Workflow
Windows Workflow Foundation
Business to Business• Supply Chain Mgmt…Business to Business• Supply Chain Mgmt…
Line of Business Apps• Quote to Cash, Sales Automation…
Line of Business Apps• Quote to Cash, Sales Automation…CRM ERP
IT Management• New Hire Provisioning, Trouble Ticket,…
IT Management• New Hire Provisioning, Trouble Ticket,…
.NET Developer• Pageflow, Service Coordination…
.NET Developer• Pageflow, Service Coordination…
Windows Workflow FoundationWindows Workflow Foundation
Key ConceptsKey Concepts
Host Process
WindowsWorkflow Foundation
Runtime Engine
A Workflow
An Activity
Runtime Services
Base Activity Library
Custom Activity Library
Visual Designer
Visual Designer:Visual Designer: Graphical and Graphical and code-based constructioncode-based construction
Workflows are a set of ActivitiesWorkflows are a set of Activities
Workflows run within a Host Workflows run within a Host Process:Process: any application or any application or serverserverDevelopers can build their own Developers can build their own Custom Activity LibrariesCustom Activity Libraries
ComponentsComponentsBase Activity Library:Base Activity Library: Out-of-Out-of-box activities and base for custom box activities and base for custom activitiesactivitiesRuntime Engine:Runtime Engine: Workflow Workflow execution and state managementexecution and state managementRuntime Services:Runtime Services: Hosting Hosting flexibility and communicationflexibility and communication
Workflow BasicsWorkflow Basics
A workflow is a classA workflow is a class
A workflow class may be defined in markupA workflow class may be defined in markup
Imports System.Workflow.ActivitiesPublic Class MyWorkflow Inherits SequentialWorkflow …
End Class
<?Mapping XmlNamespace="Activities" ClrNamespace="System.Workflow.Activities" Assembly="System.Workflow.Activities" ?>
<SequentialWorkflow x:Class="MyWorkflow" xmlns="Activities" xmlns:x="Definition"> …</SequentialWorkflow>
Workflow ExecutionWorkflow ExecutionMy Application
rt.StartWorkflow(typeof(WF1));
Instance Manager
Persistence
11 App calls StartWorkflow(…)
WF1
Invoke1
22 Instance Manager:• Loads workflow type • Creates instance• Enqueues WF1 with Scheduler
33 Scheduler dequeues WF1 and calls Executor (SequentialWorkflow base)which enqueues Sequence
Activity
MyWF.dll
Persist to disk
Execute until idle
Create instance
Execute
Sequence
Save
SequentialWorkflow Execute
Sequence Execute
OnEvent1
WF1 Instance
WF1
Scheduler SequenceOnEvent1WF1
44 Dequeue Sequence and call Executorwhich enqueues OnEvent1Dequeue OnEvent1 and call Executorwhich subscribes to event
55
InstanceMgr calls Save() on WF1 (Activity base class) to serialize instance and gets back stream
66
Instance Mgr call Persistence service passing serialized stream - Persistence service saves to disk
77
BaseActivityLibrary
RuntimeEngine
RuntimeServices
Activity BasicsActivity Basics
Activities are the building blocks of workflowsActivities are the building blocks of workflowsThe unit of execution, re-use and composition The unit of execution, re-use and composition
Basic activitiesBasic activities are steps within a workflow are steps within a workflow
Composite activitiesComposite activities contains other activities contains other activitiesEG: SequenceEG: Sequence
Base Activity Library provides out-of-the-box activity setBase Activity Library provides out-of-the-box activity set
Partners and customers author custom activitiesPartners and customers author custom activitiesEG: “ApproveOrder”EG: “ApproveOrder”
Activities are classes:Activities are classes:Properties Properties andand events events are defined by the activity are defined by the activityauthor and programmable from workflowsauthor and programmable from workflows
Has Has methodsmethods that are coded by the activity author that are coded by the activity authorbut invoked by the workflow runtime (EG: Execute) or but invoked by the workflow runtime (EG: Execute) or designerdesigner
Can be built into workflow assemblies or deployed asCan be built into workflow assemblies or deployed asre-usable librariesre-usable libraries
Activities: Optional FeaturesActivities: Optional Features
Serializer
Code Generator
Designer
ToolboxItem
[Designer(typeof(MyDesigner))]
[Validator(typeof(MyValidator))]
[CodeGenerator(typeof(MyCodeGen))]
[Serializer(typeof(MySerializer))]
[ToolboxItem(typeof(MyToolboxItem))]
Validator
[SupportsTransaction][SupportsExceptionHandlers]
public class MyActivity: Activity{ ...
}
Companion ClassesCompanion Classes
Transactions
BehaviorsBehaviors
Activities: An Extensible ApproachActivities: An Extensible Approach
OOB activities,OOB activities,workflow types,workflow types,base typesbase typesGeneral-purposeGeneral-purposeActivity libraries define Activity libraries define workflow constructsworkflow constructs
Create/Extend/Create/Extend/Compose activitiesCompose activitiesApp-specificApp-specificbuilding blocksbuilding blocksFirst-class citizensFirst-class citizens
Base ActivityBase ActivityLibraryLibrary
Custom ActivityCustom ActivityLibrariesLibraries
Author new activity
Out-of-Box Activities
Extend activity
Compose activities
Vertical-specificVertical-specificactivities & workflowsactivities & workflowsBest-practice IP &Best-practice IP &KnowledgeKnowledge
Domain-SpecificDomain-SpecificWorkflow PackagesWorkflow Packages
Compliance
RosettaNet
CRM
IT Mgmt
Sequencing engine driven by activities (no fixed language)Sequencing engine driven by activities (no fixed language)
Flexible Control FlowFlexible Control Flow
Rules-driven Activities
Step2
Step1Rule1Rule1
Rule2Rule2
DataRules + data statedrive processing order
•Data-driven•Simple Conditions, complex Policies •Constrained Activity Group
State Machine Workflow
State2
State1EventEvent
EventEvent
External events drive processingorder
•Reactive, event-driven•Skip/re-work, exception handling•Graph metaphor
Sequential WorkflowStep1
Step2
Sequentialstructure prescribesprocessing order
•Prescriptive, formal•Automation scenarios•Flowchart metaphor
Spectrum of Workflow Spectrum of Workflow Authoring ToolsAuthoring ToolsLine of Business Manager / End usersLine of Business Manager / End users
WizardsWizards
Business AnalystBusiness AnalystVisio LikeVisio Like
Script Developers or VARsScript Developers or VARsScript LikeScript Like
Code Developers or ISVsCode Developers or ISVsWindows Workflow Foundation DesignerWindows Workflow Foundation Designer
Commonality between Tools:Commonality between Tools:Support a common object model for describing Support a common object model for describing Workflow informationWorkflow information
The object model needs to be exchangeable The object model needs to be exchangeable between toolsbetween tools
Take Workflow Mainstream: DesignTake Workflow Mainstream: Design
Workflow DesignersWorkflow Designers((ÀÀ la ‘ASP.NET’ Designer) la ‘ASP.NET’ Designer)
Create new workflows Create new workflows Visual (/code) authoringVisual (/code) authoringSeamlessly integrate .NET Seamlessly integrate .NET code with round-trippingcode with round-trippingVisual debuggingVisual debuggingThemes support Themes support Designer re-hostingDesigner re-hosting
Activity DesignerActivity Designer((ÀÀ la ‘UserControl’ Designer) la ‘UserControl’ Designer)Create new activitiesCreate new activitiesVisual (/code) authoringVisual (/code) authoringInherit from base activities or Inherit from base activities or start from scratchstart from scratchBlack-box/Gray-box Black-box/Gray-box composition supportcomposition supportActivity Designer
Sequential Designer State Machine
Designer
Consistent and Familiar Experience for Workflow Consistent and Familiar Experience for Workflow Development Development
Workflow Authoring ModesWorkflow Authoring Modes
.NET assembly• ctor defines
workflow
Markup OnlyMarkup Only““Declarative”Declarative”
XAMLXAML
Markup andMarkup andCodeCode
C#/C#/VBVB
Code OnlyCode Only ApplicationApplicationGeneratedGenerated
XAMLXAML C#/C#/VBVB
• XML definesXML definesworkflow structureworkflow structurelogic and data flowlogic and data flow
• XML definesXML definesworkflowworkflow• Code-beside Code-beside defines extra defines extra logic logic
• Code createsCode createsworkflowworkflowin constructorin constructor XAMLXAML C#/C#/
VBVB
App creates App creates activityactivitytree and tree and serializesserializes
Workflow Compilerwfc.exe
C#/VB Compiler
SharePoint: Start/participate, customize, and track workflows
• Workflows run inside SharePoint and are accessible across the Office System
OutLook: Receive notifications and track tasks
FrontPage: Create and customize workflows
Workflow Enabled OfficeWorkflow Enabled Office
Word, PowerPoint, Excel, InfoPath: Start/participate in SharePoint workflow
Take Workflow Mainstream: Office “12”Take Workflow Mainstream: Office “12”
•Provide document centric workflow as an integrated part of the Office experience
•Empower information workers with common workflow solutions and activities out of the box
•Empower organizations to build sophisticated workflow using the full functionality of the broader platform
Office “12” Workflow Office “12” Workflow VisionVision
Host ProcessHost Process
Windows Workflow Foundation
Runtime Engine And ServicesRuntime Engine And Services
Base Activity Library
My workflow
Runtime ServicesHosting flexibility - pluggable implementations (with defaults)
PersistencePersistence CommunicationCommunication TrackingTracking ……
Runtime EngineProvides intrinsic behaviors to activities
TrackingInfrastructure
State Management
WorkflowExecution
DynamicUpdate
Runtime ServicesRuntime Services
The workflow runtime is lightweightThe workflow runtime is lightweight
Depends on a set of servicesDepends on a set of servicesOnly Only ThreadingThreading is required is required
Often you also want Often you also want TransactionsTransactions and and PersistencePersistence
Add services programmatically or using a config Add services programmatically or using a config file file
What ships in System.Workflow.Runtime.Hosting?What ships in System.Workflow.Runtime.Hosting?Abstract service definitionsAbstract service definitions
Concrete service implementationsConcrete service implementationsDefaultThreadingService (asynchronous)DefaultThreadingService (asynchronous)
ManualThreadingService (synchronous; for ASP.NET ManualThreadingService (synchronous; for ASP.NET scenarios)scenarios)
DefaultTransactionServiceDefaultTransactionService
SqlPersistenceServiceSqlPersistenceService
Runtime ServicesRuntime ServicesHost Application
App Domain
SQL
Out of Box Services are provided that support SQL Server 2000 & 2005
Common resource services for managing threading and creating transactions
TimerService manages timers – e.g. Delay activity.
PersistenceService stores and retrieves instance state.TrackingService manages profiles and stores tracked information.
Runtime
Services
PersistenceService
TrackingService
ThreadingService
TransactionService
TimerService
Out-of-Box ServicesOut-of-Box ServicesASPNetThreadingServiceASPNetThreadingService Synchronous threading service used for in-Synchronous threading service used for in-
line execution; used by ASP module for web line execution; used by ASP module for web servicesservices
DefaultThreadingServiceDefaultThreadingService Used for asynchronous execution of Used for asynchronous execution of workflows; uses default .Net thread poolworkflows; uses default .Net thread pool
DefaultWorkflowTransactionSeDefaultWorkflowTransactionServicervice
Creates .NET transactionsCreates .NET transactions
SharedConnectionWorkflowTraSharedConnectionWorkflowTrans-actionServicens-actionService
Sql* services share connection to SqlServerSql* services share connection to SqlServer
InMemoryTimerServiceInMemoryTimerService Stores timer information in-memory, i.e. for Stores timer information in-memory, i.e. for Delay activityDelay activity
SqlTimerServiceSqlTimerService Stores timer information in SqlServer/MSDE; Stores timer information in SqlServer/MSDE; i.e. for Delay activityi.e. for Delay activity
SqlStatePersistenceServiceSqlStatePersistenceService Stores workflow instance state information in Stores workflow instance state information in SqlServer/MSDESqlServer/MSDE
SqlTrackingServiceSqlTrackingService Stores tracking information in Stores tracking information in SqlServer/MSDESqlServer/MSDE
Workflow State ManagementWorkflow State ManagementMany workflows are long runningMany workflows are long running
A workflow instance is idle when it has no A workflow instance is idle when it has no runnable workrunnable work
WF unloads-on-idle by default, but the host WF unloads-on-idle by default, but the host can take full controlcan take full control
Loading/unloading is not a concern of the Loading/unloading is not a concern of the workflow developer or the application workflow developer or the application developerdeveloper
Persistence points are checkpointsPersistence points are checkpointsTransactionsTransactions
Enable crash recoveryEnable crash recovery
Persistence occurs at:Persistence occurs at:Closure of a transactionClosure of a transaction
Closure of any activity marked [PersistOnClose]Closure of any activity marked [PersistOnClose]
Closure of the workflowClosure of the workflow
Enabling Workflow PersistenceEnabling Workflow PersistencePersistence Support for Workflow InstancesPersistence Support for Workflow Instances
Create the SQL database with the SqlStatePersistence Create the SQL database with the SqlStatePersistence schemaschema
Create a Workflow RuntimeCreate a Workflow Runtime
Define Connection StringDefine Connection String
Register StatePersistenceService with RuntimeRegister StatePersistenceService with Runtime
Register TimerService with RuntimeRegister TimerService with Runtime
Start the WorkflowStart the Workflow Loading and Unloading uses StatePersistenceServiceLoading and Unloading uses StatePersistenceServiceprivate void RunWorkflow()
{ WorkflowRuntime wr = new WorkflowRuntime(); string connectionstring = "Initial Catalog=Persistence;Data Source=localhost;Integrated Security=SSPI;";
wr.AddService(new SqlStatePersistenceService(connectionstring)); wr.AddService(new SqlTimerService(connectionstring)); wr.StartWorkflow(typeof(SimpleWorkflow));}
TrackingTracking
Track all state changes and data within the workflowTrack all state changes and data within the workflow
Emit tracking info from codeEmit tracking info from code
Dynamic changesDynamic changes
ProfileProfileXML file that specifies what to trackXML file that specifies what to track
Includes and excludes, state changes, data context, typesIncludes and excludes, state changes, data context, types
Object model to createObject model to create
TrackingInformation Tracking
Service
Host Application
StoreActivities
WorkflowInstance Query
WriteProfile
Tracking ArchitectureTracking Architecture
Workflow Runtime
Workflow Instance Listener asks each Listener asks each services for their services for their profile(s)profile(s)
Service only gets called Service only gets called based on what is based on what is specified in the specified in the profile(s)profile(s)
Multiple tracking Multiple tracking services can be loaded services can be loaded per the application’s per the application’s requirementsrequirements
Execution
Listener
SqlTrackingService
FileTrackingService
Profile
Profile
SqlTrackingService Channel
FileTrackingService Channel
Enabling Workflow TrackingEnabling Workflow TrackingTracking Support for Workflow InstancesTracking Support for Workflow Instances
Define tracking profilesDefine tracking profiles
Create workflow runtimeCreate workflow runtime
Define connection stringDefine connection string
Register one or more TrackingService’s with the Register one or more TrackingService’s with the WorkflowRuntimeWorkflowRuntime
Start the workflowStart the workflow
Query tracking database – instance and activity informationQuery tracking database – instance and activity information
private void RunWorkflow(){ WorkflowRuntime wr = new WorkflowRuntime(); string connectionstring = "Initial Catalog=Tracking;Data Source=localhost;Integrated Security=SSPI;";
//Out of the Box Tracking Service wr.AddService(new SqlTrackingService(connectionstring)); wr.StartWorkflow(typeof(SimpleWorkflow));}
Workflow & CommunicationsWorkflow & Communications
The purpose of a workflow is often to The purpose of a workflow is often to coordinate work performed outside of its coordinate work performed outside of its boundariesboundaries
Many workflows are long-running programsMany workflows are long-running programs
Communication is an inherent needCommunication is an inherent need
The communication may be The communication may be local local (intra-(intra-process)process)
To and from your hosting application codeTo and from your hosting application code
The communication may be The communication may be remoteremoteWeb servicesWeb services
Windows Communication Foundation (Indigo)Windows Communication Foundation (Indigo)
Communication ArchitectureCommunication Architecture
Local App Object
Communication Services• Proxy management• Correlation
Local Application Remote Application
Workflow Runtime
Custom Host
Workflow Instances
InvokeMethodEventSink
Activities• Model sending and receiving of data
Runtime• Scheduling
Local App Object
Local App ObjectLocal App ObjectLocal App ObjectWeb Service
WebServiceReceiveWebServiceResponseInvokeWebService
ASP.NET
Workflow
Method
Event
Local Communication ArchitectureLocal Communication Architecture
.NET object managed by the runtime acts as a .NET object managed by the runtime acts as a communication intermediary between the host and the communication intermediary between the host and the workflow instancesworkflow instances
Raises events into the workflowRaises events into the workflowProxy for outbound method callsProxy for outbound method calls
Four components:Four components:Local Communication ActivitiesLocal Communication ActivitiesContractContractLocal ServiceLocal ServiceEventArgsEventArgs
Application
DataExchangeService
Workflow Runtime
Output
Input
Local Communication ActivitiesLocal Communication ActivitiesModel sending and receiving data Model sending and receiving data
EventSink activityEventSink activityModel an event raised by a local objectModel an event raised by a local object(Application (Application Workflow) Workflow)
InvokeMethod activityInvokeMethod activityModel the invocation of a method on a local Model the invocation of a method on a local object object (Workflow (Workflow Application) Application)
OrderManager
Work
flow
Ru
nti
me
Local Communication ContractLocal Communication ContractDefine pattern of communicationDefine pattern of communication
Write an interface that defines the Write an interface that defines the contract for communication with the contract for communication with the workflowworkflow
Events for inbound data (to workflow)Events for inbound data (to workflow)
Methods for outbound data (from Methods for outbound data (from workflow)workflow)
Mark as [DataExchangeService]Mark as [DataExchangeService]
[DataExchangeService]public interface IOrderManager{ // Create a workflow instance to process the order event EventHandler<OrderEventArgs> OrderSubmitted;
// The workflow instance will later call one of these methods void Approve(string orderId); void Reject(string orderId);}
Local Communication ServiceLocal Communication ServiceImplement classImplement class
Implement the interface you’ve definedImplement the interface you’ve definedSingleton (will be shared by all workflow Singleton (will be shared by all workflow instances)instances)
Register with the runtimeRegister with the runtime
public class OrderManager : IOrderManager{ // Create a workflow instance to process the order public event EventHandler<OrderEventArgs> OrderSubmitted;
// The workflow instance will later call one of these methods public void Approve(string orderId) { … } public void Reject(string orderId) { … }}
WorkflowRuntime runtime = new WorkflowRuntime();
OrderManager orderManager = new OrderManager();runtime.AddService(orderManager);
Local Communication Event ArgsLocal Communication Event ArgsDefine event dataDefine event data
The runtime intercepts events raised The runtime intercepts events raised by the registered local object, and by the registered local object, and delivers them to the right workflow delivers them to the right workflow instancesinstances
Must derive from Must derive from WorkflowMessageEventArgs and include WorkflowMessageEventArgs and include the workflow instanceIdthe workflow instanceId
Conceptually, the registered local object Conceptually, the registered local object is addressing a workflow instance when is addressing a workflow instance when it raises an eventit raises an event
public class OrderEventArgs : WorkflowMessageEventArgs{ public OrderEventArgs(Guid instanceId, string orderId) : base(instanceId) { … }}
Services
Workflow
Coordinating ServicesCoordinating Services
Workflows are an excellent way to coordinate servicesWorkflows are an excellent way to coordinate services
Service interaction becomes:Service interaction becomes:Declarative – modeled using activities in a workflowDeclarative – modeled using activities in a workflow
Transparent - to the outside worldTransparent - to the outside world
Visual – for designing, debugging, and monitoringVisual – for designing, debugging, and monitoring
Composable - Data can be flowed from activities/servicesComposable - Data can be flowed from activities/services
Simplified - Workflows simplify message exchange patternsSimplified - Workflows simplify message exchange patterns
Flexible - Easily be modified and dynamically changedFlexible - Easily be modified and dynamically changed
Implementing Services using Implementing Services using WorkflowWorkflowChallenges developing services todayChallenges developing services today
Services are often used together as part of a business process, Services are often used together as part of a business process, but are not explicitly associatedbut are not explicitly associatedServices often front-end, long-running business processesServices often front-end, long-running business processes
Workflows are an excellent way to implement service logicWorkflows are an excellent way to implement service logicState management across multiple service interactionsState management across multiple service interactionsServices are explicitly associated in a workflow modelServices are explicitly associated in a workflow modelImplementation can be transparent Implementation can be transparent Enables runtime visibility into the state of the serviceEnables runtime visibility into the state of the serviceRuntime behavior is configurableRuntime behavior is configurable
Tracking, persistence, etc.Tracking, persistence, etc.
Services Workflow
Web Services ActivitiesWeb Services Activities
InvokeWebServiceInvokeWebServiceLike Visual Studio Add Web ReferenceLike Visual Studio Add Web ReferenceSession-awareSession-awareCan manipulate the proxy before the callCan manipulate the proxy before the call
For example, to set credentialsFor example, to set credentialsParameter bindingParameter binding
WebServiceReceive, WebServiceResponseWebServiceReceive, WebServiceResponseModel 1-way and 2-way requests to the workflowModel 1-way and 2-way requests to the workflowDefine web service contract as an interfaceDefine web service contract as an interfaceParameter bindingParameter bindingGenerate default web service project plus artifactsGenerate default web service project plus artifactswith a single click in Visual Studiowith a single click in Visual Studio
Web Services HostingWeb Services Hosting
WorkflowWebHostingModuleWorkflowWebHostingModuleASP.Net 2.0 IHttpModuleASP.Net 2.0 IHttpModule
Session-based request routingSession-based request routing
Not required to use this (replaceable)Not required to use this (replaceable)
WorkflowWebServiceWorkflowWebServiceDefault base class for published workflowsDefault base class for published workflows
Not a required base class for your web servicesNot a required base class for your web services
Workflow Runtime ServicesWorkflow Runtime ServicesASPNetThreadingServiceASPNetThreadingService
Uses request thread to process workflowUses request thread to process workflow
WebTimerServiceWebTimerServicePersistent timer servicePersistent timer service
Web ServicesWeb Services
ASP.NET
WorkflowWebHostingModule
Workflow Runtime
Runtime Services
Timer Service
Threading Service
WorkflowReceive
Response Invoke
Persistence Service
Session
Timers
Workflow State
WorkflowWebService
Build transparent, Build transparent, flexible, long-flexible, long-running web running web servicesservices
Model all data entry Model all data entry and exit pointsand exit points
Host the workflow Host the workflow runtime in ASP.NETruntime in ASP.NET
Why Workflow & Services?Why Workflow & Services?
Services make workflow more Services make workflow more accessibleaccessible
Workflows make services more Workflows make services more composablecomposable
Services Workflow
Services
Workflow & CommunicationsWorkflow & CommunicationsFoundationFoundation
Declarative control flow Declarative control flow
Simplified programming Simplified programming modelmodel
Process visualizationProcess visualization
Dynamic executionDynamic execution
Configurable runtime Configurable runtime behaviorbehavior
Secure, reliable, Secure, reliable, transactional servicestransactional services
Unified API for Unified API for communicationscommunications
Transport selectionTransport selection
Multiple Message Multiple Message Exchange PatternsExchange Patterns
WCF ActivitiesWCF Activities
Prototype activities designed for direct Prototype activities designed for direct communications using WCFcommunications using WCF
SendMessageSendMessage
ReceiveMessageReceiveMessage
SendReceiveSendReceive
ReceiveSendReceiveSend
Enables explicit asynchronous and Enables explicit asynchronous and sophisticated message exchange patternssophisticated message exchange patterns
Workflows wire up communications to Workflows wire up communications to services by configuring these activitiesservices by configuring these activities
Not provided with Windows Workflow Not provided with Windows Workflow FoundationFoundation
WCF with Local ServicesWCF with Local Services
WCF Service
Service Request
WCF Service
Service Request
OrderManagerLocal Service
WinFXWinFX
Workflow and BizTalk ServerWorkflow and BizTalk Server
Windows Windows Workflow Workflow
FoundationFoundation
MessagingMessagingDesigDesig
nnToolsTools
BusineBusinessss
ActivityActivityMonitoMonito
rrAndAnd
AdminAdminToolsTools
OrchestratioOrchestrationn
TransformatiTransformationon
AdaptersAdapters
BizTalk ServerAcceleratorsAccelerators
• Premium BPM serverPremium BPM server• Distinct server productDistinct server product• Use in B2B, EAI, BPM scenariosUse in B2B, EAI, BPM scenarios• Deployable solutionsDeployable solutions• Manageability, Scale-outManageability, Scale-out
• Workflow frameworkWorkflow framework• Exposed via WinFX Exposed via WinFX • Broad set of scenarios Broad set of scenarios • Used to build solutionsUsed to build solutions• Enables manageabilityEnables manageabilityand scale-out in solutionsand scale-out in solutions• Use for building workflow Use for building workflow into apps or workflow-enabled into apps or workflow-enabled serversservers
Visual Studio DesignerVisual Studio Designer
• Future version will migrate to Future version will migrate to Windows Workflow Foundation Windows Workflow Foundation for orchestrationfor orchestration
WorkflowWorkflow
SummarySummary
A single workflow technology for WindowsA single workflow technology for WindowsPlatform level workflow framework for use within Microsoft Platform level workflow framework for use within Microsoft products & ISV applicationsproducts & ISV applicationsWill be used by BizTalk Server, Office12, and DynamicsWill be used by BizTalk Server, Office12, and DynamicsAvailable to all Windows customersAvailable to all Windows customers
Microsoft is redefining workflowMicrosoft is redefining workflowUnified technology for System & Human workflowUnified technology for System & Human workflowMultiple styles: sequential, rules-based, state machineMultiple styles: sequential, rules-based, state machineSupports dynamic interactionSupports dynamic interaction
Microsoft is taking workflow mainstreamMicrosoft is taking workflow mainstreamConsistent and familiar programming model for reaching Consistent and familiar programming model for reaching mainstream application developermainstream application developerAvailable to millions of end-users through Office “12”Available to millions of end-users through Office “12”Extensible platform for ISVsExtensible platform for ISVs