200 likes | 362 Views
Introduction to Windows Workflow Foundation (WF). Keith Elder Microsoft MVP Blog: http://keithelder.net/blog/ Quicken Loans – http://www.quickenloans.com. Agenda. Hello World in Workflow What is Workflow? Architecture Understanding the Runtime WF Extensibility Rules Engine
E N D
Introduction to Windows Workflow Foundation (WF) • Keith Elder • Microsoft MVP • Blog: http://keithelder.net/blog/ • Quicken Loans – http://www.quickenloans.com
Agenda • Hello World in Workflow • What is Workflow? • Architecture • Understanding the Runtime • WF Extensibility • Rules Engine • Scenarios for WF • Versioning • Hosting • WF in a SOA
What is Workflow? http://tinyurl.com/38g64k The workflow framework and tools for Microsoft products and partner/customer ecosystem • Single workflow technology for Microsoft® Windows® • A framework for building workflow, not an application or server • Make declarative workflow a mainstream development paradigm • At the end of the day workflow is a new namespace and supporting APIs developers can use to declaratively express business logic and long running processes. http://tinyurl.com/38g64k
Visual Designer A Workflow An Activity Custom Activity Library Windows Workflow Foundation Base Activity Library Runtime Engine Runtime Services Host Process Architecture Key Concepts • 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 • Visual Designer:Graphical and code-based construction
Understandingthe Runtime Host Application App Domain Runtime Services Out of Box Services are provided that support SQL Server 2000 & 2005 Services PersistenceService stores and retrieves instance state. SQL PersistenceService TrackingService TrackingService manages profiles and stores tracked information. SchedulerService TransactionService Common resource services for managing threading, timers and creating transactions http://tinyurl.com/yuwsew
Domain-Specific Workflow Packages Compliance CRM Extend activity Compose activities RosettaNet Author new activity IT Mgmt • Vertical-specific activities and workflows • Best-practice intellectual property (IP) and knowledge Activites: An Extensible Approach Custom Activity Libraries Base Activity Library Out-of-Box Activities • OOB activities, workflow types, • base types • General-purpose • Activity libraries • define workflow • constructs • Create/Extend/ Compose activities • App-specific building blocks • First-class citizens
WF Extensibility Designer Rehosting http://tinyurl.com/36vs2j
Workflow Rules • Conditions on activities • If-Else • While • Replicator • Conditioned Activity Group (CAG) • <Your custom activity> • Policy activity • Contains and executes a RuleSet • RuleSet execution provides priority-based, forward-chaining semantics • Rules can be used outside workflow
Rule 1 (P0) If Total > $50 & < $100 ThenDiscount = 10% Rule 2 (P0) IfTotal >= $100 ThenDiscount = 15% Rule 3 (P0) IfAmount > $0 Then Total = Total + Amount Rule 1 Rule 3 Rule 2 Forward Chaining Execution Sequence RuleSet Amount = $25 Total = $80 Discount $105 = 10% 15%
Policy Overview • Policy activity references a RuleSet in the workflow.rules file • RuleSet class contains a collection of Rules • Rules are If-Then-Else expressions that evaluate and operate on workflow members
CAG - Overview Child activities • Child activity executes • When(Condition1) • CAG executes • Until(Condition2) • Default execution is a parallel • When • Executes activity once • Until • “All children quiescent” • Executing children complete and all When conditions == false Conceptually, an activity executes: IF When && !(Until)
Versioning in WF – Where? • Workflow • Activity • Tracking Profile • Rules • Host and runtime services • Exposed as a web service
Workflow Versioning • Compiled • Standard .NET versioning story • Strong Names, GAC, etc. • What I’m not going to dive into the details of • Declarative • This is what we call XAML-only workflows • Versioning here takes place in the host, when deciding what XAML to grab • But wait, my workflows are already running! • DynamicUpdate API address how to change these
Scaling? Cluster of Workflow Runtimes accessing the same persistence store Host N Host 2 Host 3 Host* 1 WorkflowRuntime 1 WorkflowRuntime 2 WorkflowRuntime 3 WorkflowRuntime N SQL Persistence Service SQL Persistence Service SQL Persistence Service SQL Persistence Service SQL * The host could be IIS
WF in a SOA WF As Service Implementation WF Orchestrating Services
Introduction to Windows Workflow Foundation (WF) • Keith Elder • Microsoft MVP • Blog: http://keithelder.net/blog/ • Quicken Loans – http://www.quickenloans.com