The world of .NET and Web Programming

Windows Workflow 102 or WF Part 2

So, last time around, I left off at the issue about my struggles with the ExternalDataService that ships in WF and purports to be the general mechanism to get data in and out of a workflow. Harry responded that he didn't like EDS and that I get real intimate with the WorkflowQueuingService which is the low-level communication infrastructure that ExternalDataExchange builds on top of. I also heard from Matt Winkler in email who pretty much pointed in the same direction, emphasizing that EDS is an abstraction that sits on top of a pretty basic queuing mechanism that you can program against and build on. One is not restricted to HandleExternalEvent, ExternalDataExchangeService but I would have to build the abstraction in the host to route the messages into the queue, and then have activities that wait on the queue. The first point of this post is to make my readers aware of this option and the documented EDS is not the only option for data in/out.

One of the other main areas is WCF Integration, which actually can be achieved on top of the WorkflowQueuingService. We (at work) will not be able to use Orcas as our workflow deliverables are by this August and banks will not accept 3.5 for quite some time (if not years). So I have to build my own WCF/WF Integration. The first place I looked was the WCF Activities for WF project on CodePlex. This excellent project by Marcel builds a necessary infrastructure.

For instance, there is an base InputActivity class that implements the IEventActivity Interface for event-driven activities.

/// <summary>

/// <summary>

/// Base class for activities that dequeue data from a workflow queue

/// Base class for activities that dequeue data from a workflow queue

/// </summary>

/// </summary>

public abstract class InputActivity : Activity, IEventActivity, IActivityEventListener<QueueEventArgs> {

public abstract class InputActivity : Activity, IEventActivity, IActivityEventListener<QueueEventArgs> {

The two interfaces look like:

public interface IEventActivity

{

   IComparable QueueName { get; }

 

   void Subscribe(ActivityExecutionContext parentContext,

      IActivityEventListener<QueueEventArgs> parentEventHandler);

   void Unsubscribe(ActivityExecutionContext parentContext,

      IActivityEventListener<QueueEventArgs> parentEventHandler);

}

 

public interface IActivityEventListener<T> where T : System.EventArgs

{

   void OnEvent(object sender, T e);

}

Tomas goes over these two interfaces and Event-Driven Activities in a Part 1 and Part 2 set of articles in some detail so I will not repeat that material here, other than to note their implementation in derived classes here. 

The InputActivity class provides an abstraction over the queues and events. From there, you can derive a WCFInputActivity. It looks like good stuff that I can use.

I am looking in Part 3 to actually step back, go over general Workflow concepts and then give some intro WF material. It's about time with a Part 3 right?

 

» Similar Posts

  1. Windows Workflow 101 or 2 Months with WF
  2. Windows Workflow 103 or WF Part 3 - Introduction to Workflow
  3. Enterprise Service Buses (ESB) Drive SOA Adoption - Part 1

Comments are closed