Windows Workflow Foundation at a glance

Introduction

This article is intended to show information about Windows Workflow Foundation (WWF) of key part of Microsoft.NET 3.0 technologies suite. I will illustrate the concepts and the main components of this technology.

WWF

WWF is the new Microsoft initiative to define, execute and manage workflows. It provides a singular engine to execute workflows. It also supports human workflow (person-centric) as well as highly structured application-centric workflows.

The WWF Engine

The WWF engine is the hosting environment which allows the execution and management of workflows.

The architecture of WWF engine is illustrated in the Figure 1. You can see that WWF doesn't have an intrinsic execution process (at the bottom of the figure); instead, it is an in-process engine that runs inside a host process. There are available a variety of host process for WWF such as console applications, WinForms applications, ASP.NET applications, Web Services applications, Windows services, and SharePoint server.

Now, we're going to analyze each layer in the WWF architecture. The hosting layer provides interfaces between WWF and the host environment which supports the following services: Communication, Persistence, Tracking, Timer, Threading and Transaction. In this way, WWF can take advantage of the capabilities in specific hosts. Persistence service allows storing the state of workflow beyond its execution, because some workflows may execute in short period of time, but other workflows may take days, even months. The Timer service allows the engine to wait for an event to continue. The Tracking service provides interfaces to receive tracking events from the runtime and pass to the host applications to persist this tracking information. Communication service allows receiving and sending message to the host. The messages trigger workflow, and move activities sequences in the workflow. The interfaces may implement any communication protocol, thus in this level we have an independent layer from the outside.

The runtime layer is the most important component of WWF technology. The components of this layer provide critical services such as execution, tracking, state management, scheduler and rules. The execution service schedules activities and supports common behaviors such as event handling, exceptions, tracking, and transactions. The tracking service creates the tracking information that is sent through the tracking interface. The state management service manages the state to be persisted through the persistence interface. The scheduler service creates the plans for the workflow's execution. And finally, the rules service provides policy execution functionality.

img1.jpg

Figure 1.

The workflow model comprises model types, activities, and the main programming API use by developers writing code for WWF.

In WWF, you can find to model to specify the workflow:

  • Sequential workflow: is a structured workflow where an activity in the workflow follows another activity and the path is highly predictable and sequential. It is mainly used to represent system-to-system workflow.
  • State machine workflow: uses the approach of states and transitions between states to represent the workflow. There is no determinist path between the activities. This model is effective to represent human workflow.

WWF and Visual Studio.NET

When you install Microsoft.NET 3.0 and extension for Visual Studio.NET, you can see a graphical designer which gives the users the ability to drag and drop activities and model the workflow.

To create a simple WWF project, go to File|New|Project from the main menu and in the New Project windows,in the Project Types select Workflow and in the Templates you can see several workflow models and host environment combination, as illustrated in Figure 2.

img2.jpg

Figure 2.

In the Figure 3, you can see the designer opened by Visual Studio.NET (VS.NET). You can describe the workflow by dragging and dropping shapes from the toolbox in the left side of VS.NET.

img3.jpg

Figure 3.

Conclusion

In this article, you learn the main concepts of Windows Workflow Foundation technology and how it is integrated in Visual Studio.NET. Next articles about this topic will cover how to develop applications using the technology in different business scenarios.