SlideShare a Scribd company logo
Usman Zafar Malik
Agenda What is Workflow? Workflow Types  Fundamentals of Workflows Activities Custom Activities Types of Activities Workflow Framework How to Use Windows Workflow Foundation Windows Workflow and XAML Architecture Diagram Windows Workflow Runtime Hosting the Windows Workflow Runtime Runtime Services Creating Workflow-Enabled Services Modify Running Workflows WF in perspective of .NET 3.5 Summary Demos
What is Workflow? A workflow is the series of steps, decisions, and rules needed to complete a specific task. Example    Order food at the local pizza shop     Tell the cashier the type of pizza you want     The cashier passes this information to the cook     Who gathers ingredients and puts a pizza in the oven     The cook hands a finished pizza to the cashier     Who collects payment and completes the workflow by handing  over your pizza The work   flows , to the cashier, then to the cook, and then back again. * Programming  Windows Workflow Foundation Practical WF Techniques and Examples using XAML and C#
Workflow Types Three types of workflows Sequential Workflows State Machine Workflows Rules-Driven Workflows
Workflow Types (contd) Sequential Workflow It progresses from one stage to next and cannot step back. Example: Flow Chart Based. State Machine Workflow It progresses from “State” to “State” and are more complex and can return to the previous point. Rules-Driven Workflow Implemented based on Sequential workflow. The rules dictate the progress of the workflow.
Fundamentals of Workflows
Activities Activities are the building blocks of workflows. All steps within a workflow are performed by executing an activity. All activities in WF derive from an Activity base class Activities define some common operations like “Execute” and “Cancel” Activities define some common properties like “Name” and “Parent”. Activities define some common events like “Executing” and “Closed”. Primitive activities in the library provides a foundation to build upon. Includes control flow operations like IfElseActivity, WhileActivity. Also includes activities to wait for events, to invoke Web Services, to execute a rules engine etc
Activities (contd)
Custom Activities Allows developers to extend the functionality of base activity library by creating custom activities to solve problems in their specific domain. All custom activities will also ultimately derive from the base Activity class The workflow engine makes no special distinction between activities written by Microsoft and custom activities written by third parties Example  Pizza Order Case: “SendOrderToKitchen” or “NotifyCustomer” etc
Types of Activities Two types of activities Sequence Activities Event-Driven Activities
Sequence Activities A sequential workflow completes one activity and moves to the next, executing a sequence of consecutive steps. The “SequentialWorkflowActivity” class derives from the “SequenceActivity” class, which in turn derives from the CompositeActivity class. The “CompositeActivity” class provides the logic for an activity to contain one or more child activities. A sequential workflow will typically contain multiple children, and sequence activity provides the logic to execute child activities.
Sequence Activities (contd) The Sequence Activity iterates through its children in a forward-only direction, executing each child once and then moving to the next child. When the last child activity is complete, the sequence is finished. This doesn't mean a sequential activity cannot loop or branch, but it does mean execution always moves forward.  There is no mechanism available to jump back to an arbitrary activity in the workflow.
Sequence Activities (contd)
Event-Driven Activities A state machine workflow is an event-driven workflow. The state machine workflow relies on external events to drive the workflow to completion. What is a State Machine? Elaborate in the Diagram shown below
Event-Driven Activities (contd) A  transition  moves the state machine to the next state. A transition can only occur in response to an event. Transitions don't have to move the state machine to a new state—a transition could loop back to the same state Each state can be activated after a predefined action has taken place; then, the engine executes the activities needed and stops after completion of the next state. There is no deterministic execution path between the steps because the Workflow does not execute in a chronological order
Workflow Framework WF is an extensible framework to deal with workflows in applications of any type. It is a set of classes and design tools that help you create and develop workflows into your applications.  Just as the  System.Windows  namespace helps you create windows applications, the  System.Workflow  namespace will help you create workflows WF provides the base workflow classes for Sequential Workflows and State Machine Workflows
How to Use Windows Workflow Foundation Microsoft Visual Studio 2005 Extensions for Windows Workflow. Where as in Microsoft Visual Studio 2008 it is built in.
Windows Workflow and XAML eXtensible Application Markup Language (XAML, Pronounced as Zammel) XAML file are the valid XML files. It brings a declarative programming model to Windows Workflow. Designer can read/write XAML. XAML is not a technology specific to Windows Workflow, it also present in WPF, which declaratively constructs a rich user interface consisting of not only buttons and labels, but also animation storyboards etc
Architecture Diagram
Architecture Diagram (contd) Top Layer At the top of the model is the location where developers build the code to run a workflow. This layer provides the out-the-box Activities, the model for the construction of custom Activities, and the engine to build rules. Middle Layer The Runtime layer ensures the execution aspects of the workflow and contains the mission-critical services required: for example, the state management and persistence service, the rules service that provides policy execution functionality, the scheduler service, and the tracking service. Bottom Layer The Hosting layer is the connecting link between the Workflow Foundation and the outside world and provides a package of services (Persistence, Timer, Tracking, Communication) needed to guarantee the control and management of the workflow.
Windows Workflow Runtime View the workflow activities as instructions, or opcodes, for a workflow processor to execute. In Windows Workflow, the processor is in the WF runtime. Workflow runtime provides common facilities for running and managing the workflows and can be hosted in any CLR application domain, be it a Windows Service, a Console, GUI or Web Application.
Hosting the Windows Workflow Runtime WF lives inside a handful of assemblies like System.Windows.Workflow.Runtime Like ASP.Net Runtime, the WF needs a host process to load, initialize and start its runtime before anything interesting can happen. WF will be useful in a variety of different hosts. We can host WF in a smart client application, a console application, or a Windows service, for instance.
Hosting the Windows Workflow Runtime (contd) Example    Create Instance of WorkflowRuntime     Calling Start() method of Runtime     Create the Worflow Instance     Executing the Workflow Instance Start( ) method     Worflow Completed then the Workflow Runtime fire   Workflow Completed Event.
Hosting the Windows Workflow Runtime (contd)
Runtime Services WF assemblies provide important services to the workflow runtime. AddService allows us to make one or more  services  available to the runtime There are different types of Runtime Services are available Scheduling Service Transaction Service Persistence Service Tracking Service
Scheduling Service A scheduling service controls threads the runtime needs to execute workflows. The threads are separate from the host application because the workflows do not block any application thread and executes asynchronously. We can control the maximum number of workflows that runs simultaneously. Two types of scheduling services DefaultWorkflowSchedulerService    Asynchronously ManualWorkflowSchedulerService    Synchronously
Scheduling Service (contd) The “ DefaultWorkflowSchedulerService ” creates new threads to execute workflows. The “ ManualWorkflowSchedulerService ” is available when the host application is willing to donate threads to the workflow runtime. Denoating a thread to the Runtime is useful technique in server‑side applications, like ASP.NET web applications and web services. The  ManualWorkflowSchedulerService  forces the workflow instance to be run on the host instances thread so the host application is blocked until the workflow instance completes or becomes idle.  This method is recommended when it is important to conserve the .Net thread pool, specifically when a workflow is instantiated by ASP.Net.
Scheduling Service (contd)
Transaction Service The purpose of the transaction service it to enable custom logic regarding the commitments of work batches (also known as Persistent Points) DefaultWorkflowCommitWorkBatchService. SharedConnectionWorkflowCommitWorkBatchService. Both “DefaultWorkflowTransactionService” and “SharedConnectionWorkflowTransactionService” inherit from “ WorkflowTransactionService ” which is the base transaction service class
Persistence Service This service saves the current state of the workflow. In workflows if state is not saved then user will lost the data and workflows would be terminated while in process. It is desirable to unload the process from the memory so that the resources are not held.  It restarts the process from the same state getting from the persistence store from where it is saved.  Example:  user approval process is accomplished and workflow restarts from the persistent state.
Persistence Service (contd) It is useful in those scenarios where the activity may take long time getting a response, like waiting for an approval from a user. Default Runtime Service supplied with WF is “SQLStatePersistenceService”. The state is store in the SQL DB. If you are going to use this service you need to create the database and run the scripts mentioned below. SQLPersistenceService_Schema.sql SQLPersistenceService_Logic.sql It can be available at the following path “<windows>\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\SQL\EN”
Persistence Service (contd) The persistence service can be added to the runtime instance in two ways. Programmatically using code WorkflowRuntime workflowRuntime = new WorkflowRuntime(); SqlStatePersistenceService stateservice = new SqlStatePersistenceService(&quot;Data Source=localhost;Initial Catalog=WFState;Integrated Security=True&quot;); workflowRuntime.AddService(stateservice); Using a section in App.config   <WorkflowRuntime Name=&quot;SampleApplication&quot; UnloadOnIdle=&quot;true&quot;>   <Services> <add  type=&quot;System.Workflow.Runtime.Hosting.SqlStatePersistenceService,  System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral,  PublicKeyToken=31bf3856ad364e35&quot; ConnectionString=&quot;Data Source=localhost;Initial  Catalog=WFState;Integrated Security=True;&quot; />   </Services> </WorkflowRuntime>
Persistence Service (contd) There are different attributes that can be defined are OwnershipTimeoutSeconds    Loading instance for the  specified period of time UnloadOnIdle    True means persist the workflow and  unload it from memory LoadIntervalSconds    How frequently check for  expired timers in workflow EnableRetries    True tells the service to retry persisting  a workflow if it fails
Persistence Service (contd)
Tracking Service This service is used to track the activity in the running workflows. A tracking service uses a  tracking profile  to filter the information it receives about a workflow The WF runtime can send information about workflow events, activity state changes, rule evaluations, and our own custom instrumentation data. The tracking service decides what it will do with the data it receives. The service could write tracking data to a log file, or save the data in a database. The tracking service can participate in transactions with the workflow runtime to ensure the information it records is consistent and durable. Provides things like when the workflow begins execution, when it ends, when each activity within the workflow is entered and exited.
Tracking Service (contd)
Tracking Service (contd) The runtime sends three types of events to the tracking service. Workflow events Activity events User events
Tracking Service (contd) Workflow Events Workflow events describe the life cycle of the workflow instance. Created ,  Completed ,  Idle ,  Suspended ,  Resumed ,  Persisted ,  Unloaded ,  Loaded ,  Exception ,  Terminated ,  Aborted ,  Changed , and  Started. Activity Events Activity events describe the life cycle of an individual activity instance. Activity-execution status events include  Executing ,  Closed ,  Compensating ,  Faulting , and  Canceling. User Tracking Events When creating the business logic for an activity, the activity author might want to track some business- or workflow-specific data. This can be achieved by calling any of the overloaded  Activity.TrackData  methods. The data tracked in this manner is sent to the tracking service as a User Tracking Event
Tracking Service (contd) Tracking information sounds like a useful feature for system administrators who want to analyze resource usage, but there are also tremendous business scenarios for tracking information, like record tracking number of open/closed invoices etc. Default tracking service provided by WF is “SQLTrackingService”.  It requires a SQL database. If you are going to use this you need to create a database in SQL Server and run the specified scripts mentioned below Tracking_Schema.sql Tracking_Logic.sql It can be available at the following path “<windows>\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\SQL\EN”
Tracking Service (contd)
Creating Workflow-Enabled Services In .NET 3.5 you can use WF and WCF together to create workflow-enabled services. This combination depends on two new WF activities. Send: Sends a request via WCF, then optionally waits for a response. A developer specifies the operation that should be invoked and the endpoint that at which that operation can be found. Receive: Receives an incoming request via WCF, then sends a response. The developer specifies just the operation that accept this incoming request. Receive is a composite activity. This activity can be used to cause a running workflow to wait for an incoming request, or a workflow that begins with a Receive activity can have a new instance created when a request arrives.
Modify Running Workflows Human workflow requires the ability to make changes on the fly. To allow this , WF include “ dynamic update ”. Using this a running instance of any workflow can be modified within safe, well-defined boundaries specified by its creator, then potentially save as a new workflow. A new activity can be inserted into the workflow. Or a rule condition changed for an IfElse or CAG activity.
WF in perspective of .NET 3.5 Basically a Model Driven Service Oriented Application. Model Driven means, creating a process model using workflows as the medium for creating those models Service Oriented means, you are exposing all the components of your application as service which are talking to each other using messages and services as the underline layer.
Summary Windows Workflow allows you to organize a set of activities into a workflow. Workflows can be sequential or state machines. You can create your own custom activities. Workflows can be hosted in a variety of host applications   The Architecture of the Window Workflow Foundation. Four types of Runtime services provided to workflows. Workflow can make the application faster to build, quicker to change and easier to customize.
Thanks !

More Related Content

What's hot (20)

PPTX
Workflow Manager 1.0 SharePoint 2013 Workflows
Damir Dobric
 
PDF
Workflow Manager for Software License Optimization
Flexera
 
PPTX
Windows Azure Workflows Manager - Running Durable Workflows in the Cloud and ...
BizTalk360
 
PDF
C# Advanced L10-Workflow Foundation
Mohammad Shaker
 
PPTX
Install, configure and customize TFS 2013
Davide Benvegnù
 
PPTX
20140211 BTUG.be - Workflow Manager
BTUGbe
 
PPTX
SPS vancouver is it possible to do devops with SharePoint Framework
Vincent Biret
 
PPTX
Build a SharePoint website in 60 minutes
Ben Robb
 
PDF
Deployment Automation in de praktijk
Delta-N
 
PDF
[Struyf] Automate Your Tasks With Azure Functions
European Collaboration Summit
 
PPTX
Building high scale, highly available websites in SharePoint 2010
Ben Robb
 
PPTX
How to automate the SharePoint Provisioning
Knut Relbe-Moe [MVP, MCT]
 
PPTX
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
European Collaboration Summit
 
PDF
Tfs 2015 Upgrade Tips and Tricks
InCycleSoftware
 
PPTX
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris O'Brien
 
PPTX
COB - Azure Functions for Office 365 developers
Chris O'Brien
 
PPTX
Can you build a Intranet with Modern SharePoint
Knut Relbe-Moe [MVP, MCT]
 
PPTX
ECS19 - Ingo Gegenwarth - Running Exchange in large environment
European Collaboration Summit
 
PPTX
#SPSBrussels 2017 vincent biret #azure #functions microsoft #flow
Vincent Biret
 
PDF
2014 12-02 alm day - optimisez les cycles de développement avec la plateforme...
Nabil Babaci
 
Workflow Manager 1.0 SharePoint 2013 Workflows
Damir Dobric
 
Workflow Manager for Software License Optimization
Flexera
 
Windows Azure Workflows Manager - Running Durable Workflows in the Cloud and ...
BizTalk360
 
C# Advanced L10-Workflow Foundation
Mohammad Shaker
 
Install, configure and customize TFS 2013
Davide Benvegnù
 
20140211 BTUG.be - Workflow Manager
BTUGbe
 
SPS vancouver is it possible to do devops with SharePoint Framework
Vincent Biret
 
Build a SharePoint website in 60 minutes
Ben Robb
 
Deployment Automation in de praktijk
Delta-N
 
[Struyf] Automate Your Tasks With Azure Functions
European Collaboration Summit
 
Building high scale, highly available websites in SharePoint 2010
Ben Robb
 
How to automate the SharePoint Provisioning
Knut Relbe-Moe [MVP, MCT]
 
[Patel] SPFx: An ISV Insight into latest Microsoft's customization model
European Collaboration Summit
 
Tfs 2015 Upgrade Tips and Tricks
InCycleSoftware
 
Chris OBrien - Pitfalls when developing with the SharePoint Framework (SPFx)
Chris O'Brien
 
COB - Azure Functions for Office 365 developers
Chris O'Brien
 
Can you build a Intranet with Modern SharePoint
Knut Relbe-Moe [MVP, MCT]
 
ECS19 - Ingo Gegenwarth - Running Exchange in large environment
European Collaboration Summit
 
#SPSBrussels 2017 vincent biret #azure #functions microsoft #flow
Vincent Biret
 
2014 12-02 alm day - optimisez les cycles de développement avec la plateforme...
Nabil Babaci
 

Viewers also liked (16)

PPTX
Microsoft Workflow Foundation 4
Etisalat
 
PPT
Scalable web-based workflow platform
Ashutosh Bijoor
 
PDF
workflow in temporal state machine v1
Gordon Morrison
 
PPTX
Workflow Foundation 4
Robert MacLean
 
PDF
State Machine Workflow: Esoteric Techniques & Patterns Everyone Should Buy pr...
European SharePoint Conference
 
PPT
Events Workflow diagram
Colin Thomson
 
PDF
Workflow for XPages
Niklas Heidloff
 
PPTX
Corporate Workflow Process - Complaints and Legal Matters (illustration)
Elizabeth Baker, JD, CRCMP
 
PDF
The Workflow Reference Model
Aldo Quelopana
 
PPTX
Neuro4j Workflow Overview
Dmytro Pavlikovskiy
 
PDF
Djangocon 09 Presentation - Pluggable Applications
Nowell Strite
 
PPTX
Cognitive IBM Watson Services for Bluemix Developers
Niklas Heidloff
 
PDF
A simple workflow system using state machines
dhpeterson
 
PDF
Introduction to Enterprise Architecture and TOGAF 9.1
iasaglobal
 
PPTX
Java workflow engines
Mohammed Fazuluddin
 
PPTX
Managing Complexities of Smart Cities TOGAF way
Uday K Bhatt
 
Microsoft Workflow Foundation 4
Etisalat
 
Scalable web-based workflow platform
Ashutosh Bijoor
 
workflow in temporal state machine v1
Gordon Morrison
 
Workflow Foundation 4
Robert MacLean
 
State Machine Workflow: Esoteric Techniques & Patterns Everyone Should Buy pr...
European SharePoint Conference
 
Events Workflow diagram
Colin Thomson
 
Workflow for XPages
Niklas Heidloff
 
Corporate Workflow Process - Complaints and Legal Matters (illustration)
Elizabeth Baker, JD, CRCMP
 
The Workflow Reference Model
Aldo Quelopana
 
Neuro4j Workflow Overview
Dmytro Pavlikovskiy
 
Djangocon 09 Presentation - Pluggable Applications
Nowell Strite
 
Cognitive IBM Watson Services for Bluemix Developers
Niklas Heidloff
 
A simple workflow system using state machines
dhpeterson
 
Introduction to Enterprise Architecture and TOGAF 9.1
iasaglobal
 
Java workflow engines
Mohammed Fazuluddin
 
Managing Complexities of Smart Cities TOGAF way
Uday K Bhatt
 
Ad

Similar to Windows Workflow Foundation (20)

PPT
Wwf
Vishwa Mohan
 
PPT
The Future Of Work And Workflow
Brandon Satrom
 
PPT
Web services, WCF services and Multi Threading with Windows Forms
Peter Gfader
 
PPT
About work flow
Narender Singh
 
PDF
ASP.NET Interview Questions PDF By ScholarHat
Scholarhat
 
PPT
WF 4.0 Overview
dannicola
 
DOCX
MS flow.docx
Sharepoint Designs
 
PPTX
concept of server-side JavaScript / JS Framework: NODEJS
Kongu Engineering College, Perundurai, Erode
 
PDF
AWS Step Functions을 활용한 서버리스 앱 오케스트레이션
Amazon Web Services Korea
 
PPTX
Inventory management using temporal workflow engine
salman4test2
 
PDF
Making Workflows Work for You
Stephan Richter
 
PPT
ORCAS
mdfachowdhury
 
PPS
Wcf Transaction Handling
Gaurav Arora
 
PDF
Javascript internals
Ayush Sharma
 
PPTX
Evolution of netflix conductor
vedu12
 
PPTX
WF_in_retail_banking_enterprise_systems
Oleh Zheleznyak
 
PDF
Orchestrating complex workflows with aws step functions
Chris Shenton
 
PPTX
Azure Durable Functions
Karthikeyan VK
 
PPTX
IBM Business Automation Workflow
Mohammed El Rafie Tarabay
 
PPTX
Discover the real user experience with Alyvix - Icinga Camp Milan 2019
Icinga
 
The Future Of Work And Workflow
Brandon Satrom
 
Web services, WCF services and Multi Threading with Windows Forms
Peter Gfader
 
About work flow
Narender Singh
 
ASP.NET Interview Questions PDF By ScholarHat
Scholarhat
 
WF 4.0 Overview
dannicola
 
MS flow.docx
Sharepoint Designs
 
concept of server-side JavaScript / JS Framework: NODEJS
Kongu Engineering College, Perundurai, Erode
 
AWS Step Functions을 활용한 서버리스 앱 오케스트레이션
Amazon Web Services Korea
 
Inventory management using temporal workflow engine
salman4test2
 
Making Workflows Work for You
Stephan Richter
 
Wcf Transaction Handling
Gaurav Arora
 
Javascript internals
Ayush Sharma
 
Evolution of netflix conductor
vedu12
 
WF_in_retail_banking_enterprise_systems
Oleh Zheleznyak
 
Orchestrating complex workflows with aws step functions
Chris Shenton
 
Azure Durable Functions
Karthikeyan VK
 
IBM Business Automation Workflow
Mohammed El Rafie Tarabay
 
Discover the real user experience with Alyvix - Icinga Camp Milan 2019
Icinga
 
Ad

More from Usman Zafar Malik (9)

PPTX
SharePoint 2010 Training Session 6
Usman Zafar Malik
 
PPTX
SharePoint 2010 Training Session 5
Usman Zafar Malik
 
PPTX
SharePoint 2010 Training Session 4
Usman Zafar Malik
 
PPTX
SharePoint 2010 Training Session 1
Usman Zafar Malik
 
PPTX
SharePoint 2010 Training Session 3
Usman Zafar Malik
 
PPTX
SharePoint 2010 Training Session 2
Usman Zafar Malik
 
PPT
Easy Learning Presentation Moss 2007 Usman
Usman Zafar Malik
 
PPT
Easy Learning Presentation Moss 2007 Usman
Usman Zafar Malik
 
PPT
Presentation Moss 2007 Usman
Usman Zafar Malik
 
SharePoint 2010 Training Session 6
Usman Zafar Malik
 
SharePoint 2010 Training Session 5
Usman Zafar Malik
 
SharePoint 2010 Training Session 4
Usman Zafar Malik
 
SharePoint 2010 Training Session 1
Usman Zafar Malik
 
SharePoint 2010 Training Session 3
Usman Zafar Malik
 
SharePoint 2010 Training Session 2
Usman Zafar Malik
 
Easy Learning Presentation Moss 2007 Usman
Usman Zafar Malik
 
Easy Learning Presentation Moss 2007 Usman
Usman Zafar Malik
 
Presentation Moss 2007 Usman
Usman Zafar Malik
 

Recently uploaded (20)

PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 

Windows Workflow Foundation

  • 2. Agenda What is Workflow? Workflow Types Fundamentals of Workflows Activities Custom Activities Types of Activities Workflow Framework How to Use Windows Workflow Foundation Windows Workflow and XAML Architecture Diagram Windows Workflow Runtime Hosting the Windows Workflow Runtime Runtime Services Creating Workflow-Enabled Services Modify Running Workflows WF in perspective of .NET 3.5 Summary Demos
  • 3. What is Workflow? A workflow is the series of steps, decisions, and rules needed to complete a specific task. Example  Order food at the local pizza shop  Tell the cashier the type of pizza you want  The cashier passes this information to the cook  Who gathers ingredients and puts a pizza in the oven  The cook hands a finished pizza to the cashier  Who collects payment and completes the workflow by handing over your pizza The work flows , to the cashier, then to the cook, and then back again. * Programming Windows Workflow Foundation Practical WF Techniques and Examples using XAML and C#
  • 4. Workflow Types Three types of workflows Sequential Workflows State Machine Workflows Rules-Driven Workflows
  • 5. Workflow Types (contd) Sequential Workflow It progresses from one stage to next and cannot step back. Example: Flow Chart Based. State Machine Workflow It progresses from “State” to “State” and are more complex and can return to the previous point. Rules-Driven Workflow Implemented based on Sequential workflow. The rules dictate the progress of the workflow.
  • 7. Activities Activities are the building blocks of workflows. All steps within a workflow are performed by executing an activity. All activities in WF derive from an Activity base class Activities define some common operations like “Execute” and “Cancel” Activities define some common properties like “Name” and “Parent”. Activities define some common events like “Executing” and “Closed”. Primitive activities in the library provides a foundation to build upon. Includes control flow operations like IfElseActivity, WhileActivity. Also includes activities to wait for events, to invoke Web Services, to execute a rules engine etc
  • 9. Custom Activities Allows developers to extend the functionality of base activity library by creating custom activities to solve problems in their specific domain. All custom activities will also ultimately derive from the base Activity class The workflow engine makes no special distinction between activities written by Microsoft and custom activities written by third parties Example Pizza Order Case: “SendOrderToKitchen” or “NotifyCustomer” etc
  • 10. Types of Activities Two types of activities Sequence Activities Event-Driven Activities
  • 11. Sequence Activities A sequential workflow completes one activity and moves to the next, executing a sequence of consecutive steps. The “SequentialWorkflowActivity” class derives from the “SequenceActivity” class, which in turn derives from the CompositeActivity class. The “CompositeActivity” class provides the logic for an activity to contain one or more child activities. A sequential workflow will typically contain multiple children, and sequence activity provides the logic to execute child activities.
  • 12. Sequence Activities (contd) The Sequence Activity iterates through its children in a forward-only direction, executing each child once and then moving to the next child. When the last child activity is complete, the sequence is finished. This doesn't mean a sequential activity cannot loop or branch, but it does mean execution always moves forward. There is no mechanism available to jump back to an arbitrary activity in the workflow.
  • 14. Event-Driven Activities A state machine workflow is an event-driven workflow. The state machine workflow relies on external events to drive the workflow to completion. What is a State Machine? Elaborate in the Diagram shown below
  • 15. Event-Driven Activities (contd) A transition moves the state machine to the next state. A transition can only occur in response to an event. Transitions don't have to move the state machine to a new state—a transition could loop back to the same state Each state can be activated after a predefined action has taken place; then, the engine executes the activities needed and stops after completion of the next state. There is no deterministic execution path between the steps because the Workflow does not execute in a chronological order
  • 16. Workflow Framework WF is an extensible framework to deal with workflows in applications of any type. It is a set of classes and design tools that help you create and develop workflows into your applications. Just as the System.Windows namespace helps you create windows applications, the System.Workflow namespace will help you create workflows WF provides the base workflow classes for Sequential Workflows and State Machine Workflows
  • 17. How to Use Windows Workflow Foundation Microsoft Visual Studio 2005 Extensions for Windows Workflow. Where as in Microsoft Visual Studio 2008 it is built in.
  • 18. Windows Workflow and XAML eXtensible Application Markup Language (XAML, Pronounced as Zammel) XAML file are the valid XML files. It brings a declarative programming model to Windows Workflow. Designer can read/write XAML. XAML is not a technology specific to Windows Workflow, it also present in WPF, which declaratively constructs a rich user interface consisting of not only buttons and labels, but also animation storyboards etc
  • 20. Architecture Diagram (contd) Top Layer At the top of the model is the location where developers build the code to run a workflow. This layer provides the out-the-box Activities, the model for the construction of custom Activities, and the engine to build rules. Middle Layer The Runtime layer ensures the execution aspects of the workflow and contains the mission-critical services required: for example, the state management and persistence service, the rules service that provides policy execution functionality, the scheduler service, and the tracking service. Bottom Layer The Hosting layer is the connecting link between the Workflow Foundation and the outside world and provides a package of services (Persistence, Timer, Tracking, Communication) needed to guarantee the control and management of the workflow.
  • 21. Windows Workflow Runtime View the workflow activities as instructions, or opcodes, for a workflow processor to execute. In Windows Workflow, the processor is in the WF runtime. Workflow runtime provides common facilities for running and managing the workflows and can be hosted in any CLR application domain, be it a Windows Service, a Console, GUI or Web Application.
  • 22. Hosting the Windows Workflow Runtime WF lives inside a handful of assemblies like System.Windows.Workflow.Runtime Like ASP.Net Runtime, the WF needs a host process to load, initialize and start its runtime before anything interesting can happen. WF will be useful in a variety of different hosts. We can host WF in a smart client application, a console application, or a Windows service, for instance.
  • 23. Hosting the Windows Workflow Runtime (contd) Example  Create Instance of WorkflowRuntime  Calling Start() method of Runtime  Create the Worflow Instance  Executing the Workflow Instance Start( ) method  Worflow Completed then the Workflow Runtime fire Workflow Completed Event.
  • 24. Hosting the Windows Workflow Runtime (contd)
  • 25. Runtime Services WF assemblies provide important services to the workflow runtime. AddService allows us to make one or more services available to the runtime There are different types of Runtime Services are available Scheduling Service Transaction Service Persistence Service Tracking Service
  • 26. Scheduling Service A scheduling service controls threads the runtime needs to execute workflows. The threads are separate from the host application because the workflows do not block any application thread and executes asynchronously. We can control the maximum number of workflows that runs simultaneously. Two types of scheduling services DefaultWorkflowSchedulerService  Asynchronously ManualWorkflowSchedulerService  Synchronously
  • 27. Scheduling Service (contd) The “ DefaultWorkflowSchedulerService ” creates new threads to execute workflows. The “ ManualWorkflowSchedulerService ” is available when the host application is willing to donate threads to the workflow runtime. Denoating a thread to the Runtime is useful technique in server‑side applications, like ASP.NET web applications and web services. The ManualWorkflowSchedulerService forces the workflow instance to be run on the host instances thread so the host application is blocked until the workflow instance completes or becomes idle. This method is recommended when it is important to conserve the .Net thread pool, specifically when a workflow is instantiated by ASP.Net.
  • 29. Transaction Service The purpose of the transaction service it to enable custom logic regarding the commitments of work batches (also known as Persistent Points) DefaultWorkflowCommitWorkBatchService. SharedConnectionWorkflowCommitWorkBatchService. Both “DefaultWorkflowTransactionService” and “SharedConnectionWorkflowTransactionService” inherit from “ WorkflowTransactionService ” which is the base transaction service class
  • 30. Persistence Service This service saves the current state of the workflow. In workflows if state is not saved then user will lost the data and workflows would be terminated while in process. It is desirable to unload the process from the memory so that the resources are not held. It restarts the process from the same state getting from the persistence store from where it is saved. Example: user approval process is accomplished and workflow restarts from the persistent state.
  • 31. Persistence Service (contd) It is useful in those scenarios where the activity may take long time getting a response, like waiting for an approval from a user. Default Runtime Service supplied with WF is “SQLStatePersistenceService”. The state is store in the SQL DB. If you are going to use this service you need to create the database and run the scripts mentioned below. SQLPersistenceService_Schema.sql SQLPersistenceService_Logic.sql It can be available at the following path “<windows>\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\SQL\EN”
  • 32. Persistence Service (contd) The persistence service can be added to the runtime instance in two ways. Programmatically using code WorkflowRuntime workflowRuntime = new WorkflowRuntime(); SqlStatePersistenceService stateservice = new SqlStatePersistenceService(&quot;Data Source=localhost;Initial Catalog=WFState;Integrated Security=True&quot;); workflowRuntime.AddService(stateservice); Using a section in App.config <WorkflowRuntime Name=&quot;SampleApplication&quot; UnloadOnIdle=&quot;true&quot;> <Services> <add type=&quot;System.Workflow.Runtime.Hosting.SqlStatePersistenceService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&quot; ConnectionString=&quot;Data Source=localhost;Initial Catalog=WFState;Integrated Security=True;&quot; /> </Services> </WorkflowRuntime>
  • 33. Persistence Service (contd) There are different attributes that can be defined are OwnershipTimeoutSeconds  Loading instance for the specified period of time UnloadOnIdle  True means persist the workflow and unload it from memory LoadIntervalSconds  How frequently check for expired timers in workflow EnableRetries  True tells the service to retry persisting a workflow if it fails
  • 35. Tracking Service This service is used to track the activity in the running workflows. A tracking service uses a tracking profile to filter the information it receives about a workflow The WF runtime can send information about workflow events, activity state changes, rule evaluations, and our own custom instrumentation data. The tracking service decides what it will do with the data it receives. The service could write tracking data to a log file, or save the data in a database. The tracking service can participate in transactions with the workflow runtime to ensure the information it records is consistent and durable. Provides things like when the workflow begins execution, when it ends, when each activity within the workflow is entered and exited.
  • 37. Tracking Service (contd) The runtime sends three types of events to the tracking service. Workflow events Activity events User events
  • 38. Tracking Service (contd) Workflow Events Workflow events describe the life cycle of the workflow instance. Created , Completed , Idle , Suspended , Resumed , Persisted , Unloaded , Loaded , Exception , Terminated , Aborted , Changed , and Started. Activity Events Activity events describe the life cycle of an individual activity instance. Activity-execution status events include Executing , Closed , Compensating , Faulting , and Canceling. User Tracking Events When creating the business logic for an activity, the activity author might want to track some business- or workflow-specific data. This can be achieved by calling any of the overloaded Activity.TrackData methods. The data tracked in this manner is sent to the tracking service as a User Tracking Event
  • 39. Tracking Service (contd) Tracking information sounds like a useful feature for system administrators who want to analyze resource usage, but there are also tremendous business scenarios for tracking information, like record tracking number of open/closed invoices etc. Default tracking service provided by WF is “SQLTrackingService”. It requires a SQL database. If you are going to use this you need to create a database in SQL Server and run the specified scripts mentioned below Tracking_Schema.sql Tracking_Logic.sql It can be available at the following path “<windows>\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\SQL\EN”
  • 41. Creating Workflow-Enabled Services In .NET 3.5 you can use WF and WCF together to create workflow-enabled services. This combination depends on two new WF activities. Send: Sends a request via WCF, then optionally waits for a response. A developer specifies the operation that should be invoked and the endpoint that at which that operation can be found. Receive: Receives an incoming request via WCF, then sends a response. The developer specifies just the operation that accept this incoming request. Receive is a composite activity. This activity can be used to cause a running workflow to wait for an incoming request, or a workflow that begins with a Receive activity can have a new instance created when a request arrives.
  • 42. Modify Running Workflows Human workflow requires the ability to make changes on the fly. To allow this , WF include “ dynamic update ”. Using this a running instance of any workflow can be modified within safe, well-defined boundaries specified by its creator, then potentially save as a new workflow. A new activity can be inserted into the workflow. Or a rule condition changed for an IfElse or CAG activity.
  • 43. WF in perspective of .NET 3.5 Basically a Model Driven Service Oriented Application. Model Driven means, creating a process model using workflows as the medium for creating those models Service Oriented means, you are exposing all the components of your application as service which are talking to each other using messages and services as the underline layer.
  • 44. Summary Windows Workflow allows you to organize a set of activities into a workflow. Workflows can be sequential or state machines. You can create your own custom activities. Workflows can be hosted in a variety of host applications The Architecture of the Window Workflow Foundation. Four types of Runtime services provided to workflows. Workflow can make the application faster to build, quicker to change and easier to customize.

Editor's Notes

  • #2: Presentation: Windows Workflow Foundation Presenter: Usman Zafar Malik
  • #3: Table of Contents What is Workflow? Workflow Types Fundamentals of Workflows Activities Custom Activities Types of Activities Workflow Framework How to Use Windows Workflow Foundation Windows Workflow and XAML Architecture Diagram Windows Workflow Runtime Hosting the Windows Workflow Runtime Runtime Services Creating Workflow-Enabled Services Modify Running Workflows WF in perspective of .NET 3.5 Summary Demos