Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Windows Workflow Foundation Adam Calderon Principal Engineer - Interknowlogy Microsoft MVP – C#

Similar presentations


Presentation on theme: "Introduction to Windows Workflow Foundation Adam Calderon Principal Engineer - Interknowlogy Microsoft MVP – C#"— Presentation transcript:

1 Introduction to Windows Workflow Foundation Adam Calderon Principal Engineer - Interknowlogy Microsoft MVP – C#

2 2 Agenda Vision, tenets and architecture What is a workflow? What is an activity? Rules More architecture and features SummaryQ&A

3 3 Workflow Vision and Goals Vision: Deliver best-in-class workflow platform & tools for Microsoft products and partner/customer ecosystem Single workflow technology for Windows Base for Microsoft products and ISV/customer solutions One technology for human and system workflow A framework not a server product or application An extensible framework based on.NET Ships as Windows OOB release and in.NET 3.0 Make workflow mainstream for.NET developers Strong workflow partner & solution ecosystem Reach mainstream application developer

4 4 Workflow Foundation.NET Information Worker document life cycle collaboration Office 12 ISV / SI solutions IT Management hire/fire resource provisioning MIIS ISV / SI solutions LOB Apps sales automation quote to cash MBS applications ISV / SI Solutions Single Workflow Technology for Windows – Scenarios Consolidating workflow investments and providing a unified framework for internal products, partners and customers.NET Developer pageflow mainstream dev ASP, WinFX ISV / SI Solutions BPI integration, B2B BizTalk ISV / SI Solutions

5 5 Tenets of Workflow Workflows coordinate work performed by people and by software Workflows are long running and stateful Workflows are transparent and dynamic through their lifecycle Workflows are based on extensible models

6 6 Host Process my app or server Workflow Foundation Architectural Concepts Runtime Engine intrinsic behavior A Workflow An Activity “long running and stateful” “coordinate people and software” “transparent and dynamic through their lifecycle” Runtime Services hosting flexibility Base Activity Library workflow constructs “extensible models” models” App Activity Library

7 7 Agenda Vision, tenets and architecture What is a workflow? What is an activity? Rules More architecture and features SummaryQ&A

8 8 A workflow is a class A workflow class may be defined in markup using System.Workflow.Activities; public class MyWorkflow: SequentialWorkflow { … } … What is a workflow?

9 9 Workflow Authoring Modes.NET assembly ctor defines workflow Markup Only “Declarative” XML Markup and Code C#/VB Code Only ApplicationGenerated XML 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 XML C#/VB App creates activity tree and serializes Workflow Compiler wfc.exe C#/VB Compiler

10 Building a Workflow Windows Workflow Foundation

11 11 Agenda Vision, tenets and architecture What is a workflow? What is an activity? Rules More architecture and features SummaryQ&A

12 12 What are Activities? An activity is a step in a workflow Has properties and events that are programmable within your workflow code Has methods (e.g. Execute) that are only invoked by the workflow runtime Think of Forms & Controls Activity == Controls Workflows == Forms Activities fall under two broad categories Basic – steps that “do work” Composite – manage a set of child activities

13 13 Out of the Box Activities Designed for modeling flow control & communications IfElse, Delay, While, State, etc. InvokeWebService, InvokeMethod, etc. Custom activities can derive from the out of the box activities Built using the same component APIs that’s available to developers

14 14 Activities: An Extensible Approach OOB activities, workflow types, base types base typesGeneral-purpose Activity libraries define workflow define workflow constructs 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

15 15 Activities out of the box Workflow types SequentialWorkflow, StateMachineWorkflow Structural Sequence, Parallel, Replicator, While… State machine State, StateInitialization, EventDriven, SetState Conditions and Rules IfElse, ConditionedActivityGroup, Policy Transactions TransactionContext, Compensate Communications CallExternalMethod, HandleExternalMethod, InvokeWebService…

16 16 Custom Activities Activity is unit of: ExecutionReuseComposition Activities enable workflow modeling Custom activity examples SendEmail, FileSystemEvent, PurchaseOrderCreated, AssignTask, etc. Simplicity Flexibility Code Activity InvokeMethod & EventSink Custom Activities InvokeWebService Activity Workflow Execution Logic

17 17 Activity Execution States Initialize Executing Closed Compensating Canceling Transition Types Activity Execution Methods Initialize()Execute()Cancel()Compensate() Activity Runtime

18 18 Activity Execution Status Returned by Execute() method Can be determined by a parent activity or workflow this.ExecutionStatus Tracked by a Tracking Runtime Service ActivityExecutionStatus Enumeration InitializedExecutingCompensatingCancelling Closed Faulting

19 19 Property Promotion Children at any depth can have their properties exposed through the composite activity Allows the workflow author / activity consumer to configure values which affect internal activity logic without exposing logic Supported through the Custom Activity Designer

20 Building an Activity Windows Workflow Foundation

21 21 Agenda Vision, tenets and architecture What is a workflow? What is an activity? Rules More architecture and features SummaryQ&A

22 22 Why Rules?   Simple semantics for defining discrete, atomic rules   Aggregation of rules into rule sets that represent rich application behavior   Declarative nature allows domain experts to concentrate on the business requirements   Model-driven design allows for rich authoring and management tools   Externalization of rule logic from application code   Rapid deployment model   Supporting impact analysis and simulation capabilities Modeling Power Approachability Ease of Change

23 23 Model-driven development Rules and Application Development Forms Data Applicationlogic Rules and policies Applicationcode Workflow model Services

24 24 Rules and Process Policy applied based on carrier, cost and schedule Condition determines if approval is required Rules set reminder time limit

25 25 Terminology Condition Expression that evaluates to True or False Rule Modeled as: IF IF THEN THEN ELSE ELSE RuleSet Collection of Rules with a set of execution semantics

26 26 Workflow Rules Conditions on activities If-ElseWhileReplicator Conditioned Activity Group (CAG) Policy activity Contains and executes a RuleSet RuleSet execution provides priority-based, forward-chaining semantics

27 27 Activities - Condition Types Code Conditions Method in workflow class that returns a Boolean Rule Conditions Declarative expression that evaluates to a Boolean

28 28 Conditioned Activity Group (CAG) Flexible, rule-driven activity execution Modeling of activity sets with numerous sequencing permutations Motivation Stage-Gate pattern Collaborative tasks Scenarios

29 29 CAG - Overview Child activity executes When(Condition1) CAG executes Until(Condition2) Default execution is a parallel When “Activity executed count == 0”  Executes activity once Until “All children quiescent”  Executing children complete and all When conditions == false Conceptually an activity executes: IF When && !(Until) Child activities

30 30 CAG - Overview Reevaluation When immediate child moves to completed state Define custom Until condition to short- circuit CAG execution Custom Until == true No new activities executed Blocked activities cancelled

31 31 Policy Separation of business logic from application sequencing Declarative statements of business intent Execution semantics to support rich sets of business logic Motivation Order validation Warranty claims management Discount calculation Scenarios

32 32 What about the BizTalk BRE? The next major version of BizTalk (post- BizTalk 2006) will be built on Windows Workflow Foundation Windows Workflow Foundation will provide the core rules engine evaluator and developer tools BizTalk will provide premium tooling and server infrastructure, e.g.: Business analyst tools RuleSet storage and management RuleSet analysis

33 33 Policy Overview RuleSet class contains a collection of Rules Rules define: IF-THEN-ELSE expressions Execution priority Maximum execution count Expressions evaluate and operate on activity properties

34 34 RuleSet Execution Semantics Rules are executed in order of priority (high  low) Forward chaining causes rule re-evaluation Implicit based on property usage Explicit using Update statement “Partially explicit” using method attributes

35 35 = 10% Rule 1 (P0) If Total > $50 & $50 & < $100 Then Discount = 10% Rule 2 (P0) If Total >= $100 Then Discount = 15% Rule 3 (P0) If Amount > $0 Then Total = Total + Amount Policy - Forward Chaining Rule 1 Rule 3 Rule 2 Execution Sequence Amount = $25 Total = $80 Discount $105 RuleSet 15%

36 Rules and Activities Windows Workflow Foundation

37 37 Agenda Vision, tenets and architecture What is a workflow? What is an activity? Rules More architecture and features SummaryQ&A

38 38 Flow Styles Several styles of flow constructs are available to support human and system workflow patterns Several styles of flow constructs are available to support human and system workflow patterns Rule-based Activities Step2 Step1 Rule1 Rule2 Data Business rules drive processing order Data-driven Rules and Policies Used in sequential and state machine State Machine Workflow State2 State1 Event Event External events drive processing order Reactive, event-driven Skip/re-work patterns Exception handling Graph metaphor Sequential Workflow Step1 Step2 Structure prescribes processing order Prescriptive, formal Automation scenarios Flowchart metaphor

39 39 Out of box Runtime Services Host Application App Domain SQL Out of Box Services are provided that support SQL Server 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 Scripts for DB are located in C:\WINDOWS\Microsoft.NET\F ramework\v3.0\Windows Workflow Foundation\SQL\EN

40 Sample Workflow Applications Windows Workflow Foundation

41 41 Additional Features Compensation Local Communication and Correlation PersistenceTracking Fault Handling Dynamic Update

42 42 Summary Windows Workflow Foundation is a framework for building workflow into applications A single workflow technology for Windows Base for Microsoft products and ISV/customer solutions Broad spectrum of human and system workflow scenarios Ships in Windows ( OOB and.NET 3.0) Activities: extensible framework approach Rules: CAG, Policy Flow styles: s equential, state machine, rule-based Runtime: intrinsic behaviors and pluggable services Rich visual designers for workflows and activities

43 43 Adam Calderon More info on InterKnowlogy www.InterKnowlogy.com More info on InterKnowlogy www.InterKnowlogy.com www.InterKnowlogy.com Contact Information Contact Information E-mail: adamc@InterKnowlogy.com adamc@InterKnowlogy.com Phone: 760-930-0075 x274 Blog: http://blogs.InterKnowlogy.com/AdamCalderon http://blogs.InterKnowlogy.com/AdamCalderon About Adam Calderon Microsoft ® MVP – C# Microsoft ® ASP.NET (UI Server Frameworks) Advisory Council Developer / Author / Speaker / Teacher

44


Download ppt "Introduction to Windows Workflow Foundation Adam Calderon Principal Engineer - Interknowlogy Microsoft MVP – C#"

Similar presentations


Ads by Google