RSS

Windows Workflow Foundation Episode 1

30 Nov

A wise man once said that if all you have is a hammer then everything you see is a nail. A wiser man (Scott Adams) pointed out that if all you have is a hammer then you’re not going to be thinking about nails because you’ll be using your hammer to hide your naughty bits on account of you being naked (seeing as all you have is a hammer). I reckon they were both right. The point is that even as a K2 consultant it’s worth knowing what the other workflow vendors are doing in the workflow world.

I have been working on a workflow project where K2 wasn’t an option. I dutifully looked at other workflow options (there are a few open source options out there) but none of them ticked enough boxes. Eventually I decided that my best option was to write my own workflow engine using windows workflow foundation.

Since you’re reading this blog I’ll assume that you are either a K2 developer, or you have no life at all and need to get out more. I’ll give you the benefit of the doubt. I’m going to be writing a series of blogs here describing windows workflow foundation from the point of view of a K2 developer. Windows workflow foundation 4 is not difficult, but if you approach it like a less-featured K2 (which is what I did) you’re going to get nowhere. Hopefully this will make it easier.

In this blog I’ll be outlining the differences between WF4 and K2 and how you should approach them differently. In later posts I’ll walk you through the process of wrapping WF4 up into a workable workflow engine.

So if you’re a K2 developer looking at WF4 for the first time, these are the things you need to keep in mind or you will get totally lost:

  1. In WF4 there is no difference between an activity and a workflow. When you start a workflow you are actually starting a new activity. You can create complex activities (similarly to how you can create a usercontrol which contains other controls) but they all become part of the same workflow. So there’s no concept of an IPC call here. In fact, you can create 2 complex workflows and add those workflows as child activities in a parent workflow, and all the workflows will have the same instance GUID assigned to them. So when I speak about a workflow I could be speaking about an activity or a group of activities as well.
  2. In WF4 there’s no concept of tasks being assigned to people. There’s no AD integration. Basically there are server tasks and that’s it.
  3. In WF4 the workflow is baked into the application. This means that when your application is running, your workflow is alive and accessible. When your app is closed, the workflow is closed as well. This is a biggie. There’s no concept of making a call to a workflow engine. You can persist your workflow to a database in order to save state but if you close your application and hope that an escalation rule will fire in the background you’reout of luck. Of course you can create a WCF service to host your workflow app, or you could use AppFabric. We will obviously do something along these lines.

Those are the main differences – if you can get your head around these points you’re well on your way to understanding WF4. The next post will speak about the workflow designer and mention some best practices. If you have any questions during the series, please feel free to ask…

 
Leave a comment

Posted by on November 30, 2011 in Windows Workflow Foundation

 

Leave a Reply

Your email address will not be published. Required fields are marked *