350 likes | 504 Views
The Windows Workflow Foundation. David Gristwood. Application Architect Microsoft Limited David.Gristwood@microsoft.com http://blogs.msdn.com/David_Gristwood/. .NET At The Core. Windows Workflow Foundation. The Programming Model, Engine And Tools For Building Workflow
E N D
The Windows Workflow Foundation David Gristwood Application Architect Microsoft Limited David.Gristwood@microsoft.com http://blogs.msdn.com/David_Gristwood/
Windows Workflow Foundation The Programming Model, Engine And Tools For Building Workflow Enabled Applications On Windows Platform.
Windows Workflow Foundation The Programming Model, Engine And Tools For Building Workflow Enabled Applications On Windows Platform. • Single workflow Technology for Windows • Redefining workflow • Take workflow Mainstream Best-In-Class Workflow Platform & Tools For Microsoft Products & Partner/Customer Ecosystem
Real World Behavior “Most suppliers confirm our orders but some forget and we need to follow up” “Orders are confirmed in 48 hours and shipped within 30 days” “What is the status of this order and what is the next step?”
Workflow Software Challenges “Most suppliers confirm our orders but some forget and we need to follow up” “Orders are confirmed in 48 hours and shipped within 30 days” “What is the status of this order and what is the next step?” Long Running & Stateful Require Flexible Control Flow Must Provide Transparency Workflows run for up to 30 days and must maintain state throughout Rendering runtime state within a visualization of the workflow control flow Flexibility for people to override or skip steps in the workflow
Why Workflow Technology? Workflows Technology Provides Abstractions To Describe Real World Scenarios
EX: Check Inventory EX: Escalate To Manager What Is A Workflow? A Set Of Activities That Coordinates People And / Or Software... Or a state diagram…. Like a flowchart….
WF Architecture VISUAL DESIGNER
Workflow Basics A workflow classmay be defined in markup A workflow is a class
Markup Only Markup Only Code only XAML XAML XAML Markup + Code C#/VB C#/VB Workflow Compiler C#/VB Compiler NET Assembly Workflow Instance Authoring Modes Workflow Runtime
Hello World Demo
Workflow Instance Loader Persistence XAML Workflow Execution Idle! Workflow Runtime Runtime Services Host Application Workflow Instance
Activities are the building blocks of workflows The unit of execution, re-use and composition Basic activities are steps within a workflow Composite activities contains other activities Base Activity Library provides out-of-the-box activity set Partners and customers author custom activities Activity Basics
Activity Basics • Activities are classes: • Properties and events are defined by the activity author and programmable from workflows • Has methods that are coded by the activity author but invoked by the workflow runtime (EG: Execute) or designer • Can be built into workflow assemblies or deployed as re-usable libraries
Compliance Extend activity Compose activities CRM Out-of-Box Activities Author new activity RosettaNet IT Mgmt Activities: An Extensible Approach Domain-SpecificWorkflow Packages Base Activity Library Custom Activity Libraries • OOB activities,workflow types, base types • General-purpose • Activity libraries define workflow constructs • Create/Extend/Compose activities • App-specificbuilding blocks • First-class citizens • Vertical-specificactivities & workflows • Best-practice IP &Knowledge Sequencing engine driven by activities (no fixed language)
Services provide host specific functionality to the WorkflowRuntime Out-of-Box or Custom services Workflow Runtime Services Host Application App Domain Runtime Services Schedules workflow execution on a thread (must have one and only one) WorkflowScheduler Service WorkflowCommitWork BatchService Commits transactions (may have one but only one) Workflow PersistenceService Saves and loads instance state & timer info (may have one but only one) TrackingService Processes state and data change events (may have one or more but only one per service instance per workflow type)
Workflow Runtime ServicesOut-of-Box services • SqlTrackingService • Stores tracked information in SQL Server/MSDE • SqlWorkflowPersistenceService • Stores timer & workflow state in SQL Server/MSDE • DefaultWorkflowSchedulerService • Used for asynchronous execution of workflows; uses default .NET thread pool • ManualWorkflowSchedulerService • Executes workflow activities on calling host thread; used for synchronous, in-line execution • DefaultWorkflowCommitWorkBatchService • Commits batches of work using .NET transactions
Tracking Data State and data changes Emit tracking info from code Dynamic changes Tracking Profile Specifies what to track Optionally serialize in XML Tracking Service Manages profiles Receives tracking events TrackingKey concepts Tracking Service • Usage • State visibility • KPI info • Archiving • Auditing Activities Profile Workflow Instance Host Application
Tracking • Simple Tracking Sample • Workflow Monitor Sample • with While and Parallel Sample Demo
Hosting a Workflow • Bring Your Own Process • Host application provides app domain and process • Windows service, console, winforms, ASP, etc. • Application manages app domain creation and lifetime • Support for multiple runtimes in an app domain • Workflow runtime runs under full trust • Web and App config file support • HttpModule provided for ASP applications
Host Comminications • Host processes communicate with workflows by exchanging data through custom local communication services • Messaging via methods and events
Host Communications WinForms Lookup Host Communications Sample Simple Input Sample Demo
Step1 Rule1 Event State1 Step1 Data State2 Event Step2 Rule2 Step2 Flexible Control Flow Rules-driven Activities Sequential Workflow State Machine Workflow Sequential structure Prescribes processing order External events drive processing order Rules + data state drive processing order • Prescriptive, formal • Automation scenarios • Flowchart metaphor • Reactive, event-driven • Skip/re-work, exception handling • Graph metaphor • Data-driven • Simple Conditions, complex Policies • Constrained Activity Group
26 Structure of State Machine Workflow Activity State Machine Workflow State Event Driven Event Driven State State Set State Event Driven Event Driven Set State Set State Event Driven Set State State Event Driven Set State
27 ExamplePO Process On Order Completed Waiting to Create Order On Order Created On Order Processed Order Created Order Processed On Order Completed On Order Shipped On Order Shipped Order Shipped Order Completed On Order Completed
State Machine Workflow Ordering State Machine Sample Speech Application Sample Demo
Workflow Mainstream: Office 2007 Office 2007 Workflow Vision Provide document centric workflow as an integrated part of the Office experience Empower information workers with common workflow solutions and activitiesout of the box Empower organizations to build sophisticated workflow using the full functionality of the broader platform Workflow Enabled Office OutLook: Receive notifications & track tasks FrontPage: Create & customize workflows SharePoint: Start / participate, customize & track workflows Word, PowerPoint, Excel, InfoPath: Start / participate in SharePoint workflow Workflows run inside SharePoint and are accessible across the Office System
Business Activity Monitor And Admin Tools Design Tools Accelerators Workflow Orchestration Messaging • Future version will migrate to Windows Workflow Foundation for orchestration Transformation Adapters • Workflow framework • Future technology exposed via WinFX • Broad set of scenarios • Used to build solutions • Enables manageability and scale-out in solutions • Use for building workflow into apps or workflow enabled servers Visual Studio Designer Windows Workflow Foundation WinFX Workflow and BizTalk Server • Biztalk Server - Premium BPM server • Distinct server product • Use in B2B, EAI, BPM scenarios • Deployable solutions • Manageability, Scale-out
BizTalk Server provides workflow across existing applications and between trading partners as part of its business process and integration feature set “If you are integrating multiple applications with some interaction that involves system workflow you should use BizTalk Server” “If you want runtime scalability, fault tolerance and administration tools you should use BizTalk Server” How to Choose?BizTalk Server or Workflow Foundation BizTalk ServerEAI, B2B & BPM • Windows Workflow Foundation is a framework for adding workflow inside a custom application • “If you are building a complete application that includes workflow you should use Windows Workflow Foundation” Windows Workflow Foundation
Workflow FAQs • When to use workflow • Which host to use • Communicating between workflow and host • Checking the status of a workflow • Sequential versus state machine workflows • Deployment options • Hosting some form of designer • Workflow performance • Workflow versus BizTalk • Workflow in Office 2007
Summary • Platform level workflow framework for use within Microsoft products & ISV applications • Will be used by BizTalk Server, Office 2007, Dynamics, … • Available to all Windows customers A SINGLE WORKFLOWTECHNOLOGY FOR WINDOWS
Windows Workflow Foundation Resources • MSDN® Workflow Page • Download the Microsoft® Visual Studio® Extensions, etc • http://msdn.microsoft.com/workflow • Community Site • Download samples, tools, and runtime service components • http://wf.netfx3.com • Forums • Ask questions in the forums • http://wf.netfx3.com/forums