Introduction to Windows Workflow Foundation Silvano Coriani ( @microsoft.com) Developer Evangelist...

Click here to load reader

  • date post

    23-Dec-2015
  • Category

    Documents

  • view

    222
  • download

    3

Embed Size (px)

Transcript of Introduction to Windows Workflow Foundation Silvano Coriani ( @microsoft.com) Developer Evangelist...

  • Slide 1
  • Introduction to Windows Workflow Foundation Silvano Coriani ([email protected]) Developer Evangelist Microsoft
  • Slide 2
  • Agenda What is Windows Workflow Foundation? Architecture & Core concepts Building Workflows Introduction to Activities Workflow Styles Workflow Authoring Tools Runtime services Workflow communications
  • Slide 3
  • Workflow Software Challenges Orders are confirmed in 48 hours and shipped within 30 days Most suppliers confirm our orders but some forget and we need to followup What is the status of this order and what is the next step? Long Running and Stateful Workflows run for up to 30 days and must maintain state throughout Flexible Control Flow Flexibility for people to override or skip steps in the workflow Transparency Rendering runtime state within a visualization of the workflow control flow Real World Behavior Software Challenges
  • Slide 4
  • Why Workflow Technology? Workflows are long running and stateful Workflows must provide transparency Workflows require flexible control flow Developer Productivity Workflows technology provides abstractions convenient to describe real world scenarios Workflow software challenges
  • Slide 5
  • A ISV developer building a line of business application chooses to use Windows Workflow Foundation within the business logic of their application. An enterprise customer uses BizTalk Server to provide system workflow across their existing line of business applications and trading partners to reduce their cycle-times and increase business visibility in a high-volume environment. Microsofts Workflow Strategy is to provide Windows Workflow Foundation as a part of the developer framework for Windows and enterprise applications that build on top of Windows Workflow Foundation for specific scenarios. For Example
  • Slide 6
  • Windows Workflow Foundation Deliver best-in-class workflow platform & tools for Microsoft products and partner/customer ecosystem Single workflow technology for Windows Available to all customers of Windows Available for use across a broad range of scenarios Redefining workflow Extensible framework & API to build workflow centric products One technology for human and system workflow Take workflow mainstream Incremental learning for mainstream.NET developer Fundamental part of the Office 12 value proposition Strong workflow partner & solution ecosystem
  • Slide 7
  • What is a workflow? A set of activities that coordinate people and / or software... EscalateToManager Example activities. CheckInventory Like a flowchart. organized into some form of workflow. Or a state diagram.
  • Slide 8
  • Workflow Scenario Spectrum Participants: people, roles Flow style: flexible, dynamic Data: unstructured, documents Participants: apps, services Flow style: prescriptive, protocols Data: structured, transactional Information Worker Document Review Information Worker Document Review System Workflow Human 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 H ire Provisioning, Trouble Ticket, IT Management New H ire Provisioning, Trouble Ticket,.NET Developer Pageflow, Service Coordination.NET Developer Pageflow, Service Coordination
  • Slide 9
  • Windows Workflow Foundation Key Concepts Host Process Windows Workflow Foundation Runtime Engine A Workflow An Activity Runtime Services Base Activity Library Custom Activity Library Visual Designer Visual Designer: Graphical and code- based construction Workflows are a set of Activities Workflows run within a Host Process: any application or server Developers can build their own Custom Activity Libraries Components Base Activity Library: Out-of-box activities and base for custom activities Runtime Engine: Workflow execution and state management Runtime Services: Hosting flexibility and communication
  • Slide 10
  • Workflow Basics A workflow is a class A workflow class may be defined in markup Imports System.Workflow.Activities Public Class MyWorkflow Inherits SequentialWorkflow End Class
  • Slide 11
  • Workflow Execution My Application rt.StartWorkflow(typeof(WF1)); Instance Manager Persistence 1 App calls StartWorkflow() WF1 Invoke1 2 Instance Manager: Loads workflow type Creates instance Enqueues WF1 with Scheduler 3 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 Sequence OnEvent1 WF1 4 Dequeue Sequence and call Executor which enqueues OnEvent1 Dequeue OnEvent1 and call Executor which subscribes to event5 InstanceMgr calls Save() on WF1 (Activity base class) to serialize instance and gets back stream6 Instance Mgr call Persistence service passing serialized stream - Persistence service saves to disk7 Base Activity Library Runtime Engine Runtime Services
  • Slide 12
  • Activity Basics 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 EG: Sequence Base Activity Library provides out-of-the-box activity set Partners and customers author custom activities EG: ApproveOrder 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
  • Slide 13
  • Activities: 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 Classes Transactions Behaviors
  • Slide 14
  • Activities: An Extensible Approach OOB activities, workflow types, base types General-purpose Activity libraries define workflow constructs Create/Extend/ Compose activities App-specific building blocks First-class citizens Base Activity Library Custom Activity Libraries Author new activity Out-of-Box Activities Extend activity Compose activities Vertical-specific activities & workflows Best-practice IP & Knowledge Domain-Specific Workflow Packages Compliance RosettaNet CRM IT Mgmt Sequencing engine driven by activities (no fixed language)
  • Slide 15
  • Flexible Control Flow Rules-driven Activities Step2 Step1 Rule1 Rule2 Data Rules + data state drive processing order Data-driven Simple Conditions, complex Policies Constrained Activity Group State Machine Workflow State2 State1 Event Event External events drive processing order Reactive, event-driven Skip/re-work, exception handling Graph metaphor Sequential Workflow Step1 Step2 Sequential structure prescribes processing order Prescriptive, formal Automation scenarios Flowchart metaphor
  • Slide 16
  • Spectrum of Workflow Authoring Tools Line of Business Manager / End users Wizards Business Analyst Visio Like Script Developers or VARs Script Like Code Developers or ISVs Windows Workflow Foundation Designer Commonality between Tools: Support a common object model for describing Workflow information The object model needs to be exchangeable between tools
  • Slide 17
  • Take Workflow Mainstream: Design Workflow Designers ( la ASP.NET Designer) Create new workflows Visual (/code) authoring Seamlessly integrate.NET code with round-tripping Visual debugging Themes support Designer re-hosting Activity Designer ( la UserControl Designer) Create new activities Visual (/code) authoring Inherit from base activities or start from scratch Black-box/Gray-box composition support Activity Designer Sequential Designer State Machine Designer Consistent and Familiar Experience for Workflow Development
  • Slide 18
  • Workflow Authoring Modes.NET assembly ctor defines workflow Markup Only Declarative XAML Markup and Code C#/VB Code Only ApplicationGenerated XAML C#/VB XML defines XML defines workflow structure logic and data flow XML defines XML definesworkflow Code-beside Code-beside defines extra logic Code creates Code createsworkflow in constructor XAML C#/VB App creates activity tree and serializes Workflow Compiler wfc.exe C#/VB Compiler
  • Slide 19
  • 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 Office Word, PowerPoint, Excel, InfoPath: Start/participate in SharePoint workflow 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 Vision
  • Slide 20
  • Host Process Windows Workflow Foundation Runtime Engine And Services Base Activity Library My workflow Runtime Services Hosting flexi