Windows Workflow Foundation class in Minneapolis (Nov 14 - 17)

by Matt Milner 17. October 2006 10:17
Next month Pluralsight has our first public offering of Introducing Windows Workflow Foundation right in my own town of Minneapolis.  We did a Double Feature with WF and WCF back in August and it was great.  If you are looking for some training on WF, check out the information page and register now "Space is limited" as they say.  
 
We'll have great hands on labs mixed in with lecture to give you the right balance of concepts with experience.  Hope to see you there. 
 
Minneapolis not convenient for you?  Leave a comment as to where you would like to see us do public Workflow courses.  Boston?  Dallas?  Seattle? Denver?  Atlanta?  Vegas?  :)  If we get enough interest for a location, we'll get a course up and running and I'll be sure to announce it here. 
 

Tags:

General Musings | Windows Workflow Foundation

Tracking the current state in a state machine workflow

by Matt Milner 11. October 2006 16:11
I've seen several requests for tracking the current state in a state machine workflow.  There are several options including adding custom activities, using call external method, or using the WorkflowIdled event and the StateMachineWorkflowInstance to do this.  They all have their drawbacks however. 
 
  1. Custom Activities - in order to use this, you either have to subclass the state activity or write a simple activity and remember to add it to every state.  HUGE headache to manage and maintain in either case and the custom state comes with its own set of problems. 
  2. using CallExternalMethod has the same issues as the custom activity. Who wants to add an activity all the time just to track data. 
  3. Using the idled event can work, but then you have to use the StateMachineWorkflowInstance class and this may entail calling up your workflow from persistence just to query information from it. 
 
The ideal solution would give you the current state when it is entered and allow you to get that information without having to do anything specific in your workflow in order to track it.  I've created a sample that uses a custom tracking service to track the state changes in a state machine workflow. 
 
The tracking service is pretty simple, defining a single activity tracking location to track the executing state of the StateActivity.  The tracking channel just writes out the state name to the console.  In your use, you can customize the tracking channel to do whatever makes sense in your application (write to DB, raise an event, etc.). 
 
Find the sample here and leave any feedback as comments. 
 

Tags:

Windows Workflow Foundation

Been a long time, here are my excuses…

by Matt Milner 11. October 2006 10:57
So, I haven't blogged in MONTHS, and here's why. 
  1. writing Pluralsight's workflow course. We had a double feature in August which was a lot of fun.  This format makes for some long days, and people were pretty fried by the end of it, but it was great teaching with Aaron and the WCF / WF content works really well together. 
  2. Getting ready for my new Son's arrival.  Jake was born on 9/16/2006 and I have been trying to keep my head above water for the last couple of weeks.  I have been spending a ton of time with my older son and getting to go to school and music class with him.  The time has been great, but now it is time to get back to work, which should prove interesting. 
  3. Doing some work for Microsoft on content/demos/etc. around WF, WCF, and CardSpace.  This has been an ongoing thing that I have been working on for the last year and has proven to be a lot of fun.  I got the chance to travel all over the world and meet some great folks doing the training. 
 
I'm getting ready to blog again and post some samples, etc. in the coming months, so for those of you still "listening", there will be something to read.  :) 

Tags:

General Musings

WSE Adapters for BizTalk Server 2006

by Matt Milner 17. May 2006 02:53
The service pack for the WSE 2.0 adapter is now available and now works with 2006 or 2004. Grab it today to start adding WSE enabled web services to your integration options. 
 
Also, the fine folks at TwoConnect have created a WSE 3 adapter for BizTalk Server 2006.  Given that Microsoft will not be creating an adapter for WSE 3, this is a great option if you need to support WSE 3.0 in your BizTalk solution today. 

Tags:

BizTalk Server

Upcoming changes to ManualWorkflowScheduler post beta 2.2

by Matt Milner 28. April 2006 10:04
Paul Andrew (Technical Product Manager for WF) has posted on some upcoming changes to the ManualWorkflowScheduler in the next drop of WF.  If you have tried using this scheduler in ASP.NET and using delay activities, then you have felt the pain he is referring to.  I think the addition of a single background thread to process the timers is a very elegant solution and look forward to testing it out on the new bits. 

Tags:

Windows Workflow Foundation

Nice article on hosting and designers

by Matt Milner 17. April 2006 18:29
If you are working with Windows Workflow Foundation and hosting the designer, then this article provides some good background and context information for you about the general designer hosting support in .NET 2.0. 
 

Tags:

Windows Workflow Foundation

I think my daily "workflow" is about to get more interesting

by Matt Milner 6. April 2006 05:05
I'm very excited about our new addition, but boy does it bring to mind all sorts of questions about time management. ;)

Tags:

General Musings

Sample to understand basic local communications in Workflow

by Matt Milner 2. April 2006 19:31
I've been teaching a lot of folks workflow as part of the Longhorn Server Ascend training and the simple example that I was using just didn't cut it.  So, I put together a set of example applications to show how the basic local communications work.  The main thing I wanted to show was how the use of an interface as the contract between your workflow and your host, allows you to swap out different hosts and provide different implementations of the local service, without the workflow having to know or care about any of this.  The workflow simply looks for a service that implements the right interface, and then calls into that class based on the interface. 
 
So, I created three different implementations of a VERY basic coffee machine: console, WinForm and ASP.NET.  The sample shows how you can simply add the right type of service implementation for your host and the workflow can be used in a number of environments.  The code is pretty well commented so you should be able to follow along. 
 
This works on WF 2.0 (Feb CTP).  Everything except the ASP.NET application will work on the 2.2 release as well.  I'll provide an update here when I get the ASP.NET example ported over to 2.2 later this week. 
 
Any feedback or questions are welcome.  Enjoy. 
 
The 2.0 compatible code is here.
I've uploaded the 2.2 compatible code here.
 

Tags:

Windows Workflow Foundation

BizTalk 2006 RTM is here!

by Matt Milner 27. March 2006 05:32
Congratulations to the BizTalk team for another awesome release and for keeping on schedule.  These guys are like clockwork man!  It was just 2 years ago that we got BizTalk 2004 and now we get this great update with awesome feature updates to BAM, administration and the messaging engine.  I'm psyched about being able to use this new release in our BizTalk course. 

Tags:

Using data driven workflow activities and repeated correlation

by Matt Milner 21. February 2006 06:11
How's that for a title?  The driver for this post is that I'm training a lot of folks right now on using WF to build workflows, and when we cover correlation, the example we use has two branches in a parallel activity where we correlate within each branch.  The question inevitably comes up about how to do this dynamically, where the number of "branches" is driven by data.  So, I whipped up this example that uses code from the Microsoft Windows Workflow Foundation Labs (Beta 2) to showcase the Replicator Activity and the Conditioned Activity Group (CAG).  These two activities provide for richer models of business rule or data driven replication using correlation. 
 
In order to enable my example, I have created a composite activity that wraps up the voting behavior found in the communications lab.  This gives me a reusable component that I can then use in multiple places in my workflow, and it also gives me the ability to set properties on the set of activities (now my single composite activity) for each instance.  For example, one of the key properties I can set is the alias, or name, of the user who should vote.  In addition, I can define events at the composite activity that my workflow can listen for and handle.  This allows my workflow to take action when a voter approves or rejects a ballot. Finally, I define a correlation token within the activity and set the parent activity to the composite activity itself.  This provides the context in which my correlation token is valid and is the key to allowing me to correlate within each activity.  Note that it is not required that you do this in a composite activity, the parent activity for your correlation token can be a sequence or some other container.  Finally, I added a property to my workflow called Aliases of type List<string>  which holds the data for my workflow.  I pass in this data from program.cs via parameters to the workflow. 
 
In my workflow, I have two main activities, the first is a replicator which shows how to use this activity to do data driven correlated activities, and the second is the Conditioned Activity Group which allows you to use rules/conditions to determine what branches of activities to run, and when I am done running them. 
 
The replicator activity in my example has the InitialData property bound to the workflow property for aliases, so I am going to run whatever activities are in the replicator as many times as I have items of data.  I also need to pass that data to each instance of the voting activity before it is executed (specifically, the alias it should use).  I use the Child_init event on the replicator to set the alias based on the current data item.  The current data item lets me get the current item in my collection of data and I can then use that to configure the currently executing activity or set of activities.  I also set the execution type property on my replicator to indicate if I want all the branches to run in parallel, or in sequence.  Very powerful option!
 
For the CAG, I have included two voting activities, and bound their aliases to two different instances of input data on the workflow.  I've done this using indexed values from the List<string> property.  When dealing with a CAG, you have to set the "when" property on each branch of execution which indicates the rule or code to determine if the particular branch should execute.  On the CAG itself, you provide a "Until" property that likewise specifies code or rules, but these provide the condition under which execution should stop.  So, the CAG will continue running (foreach/while style looping) until the "Until" condition is met. On each interation, it will use the "when" condition on each activity branch to determine whether it should run that branch.  So you get replication, but with rules to guide it.  You get a lot more than that, but this is a simple example. 
 
When you run the program, it might help to disable one activity and focus on the output by the other.  Running the replicator will give you three vote dialogs, each with the appropriate users name, and the console will appropriately log their votes.  We correlate the response back into the workflow on each instance of the votingactivity.  When you run the CAG, you'll see that the first time through, both voting activities will run.  Until you vote "yes" on one of the items, the CAG will continue to run and use the "when" condition to determine which activity branches to run.  Play around with your voting and notice what happens if you continue to vote no with one person for a few rounds, then vote yes.
 
The final thing to notice is that we have a need to catch the situation, with our CAG, where someone voted yes, but the other person has not yet responded.  If we don't deal with this scenario, when the second person votes, they will get an exception.  We use the WorkflowQueueInfo data from the workflow instance to query the workflow and see if it is waiting for any responses.  If it is not, then we gracefully exist instead of trying to raise the event.  If it is, then we go ahead and raise the event.  This is one way you can attempt to avoid the EventDeliveryFailedException. 
 
Hopefully these examples will prove useful for someone.  I plan to do my best at creating more examples to share.  As always, feedback is welcomed.  You can get the code here
 

Tags:

Windows Workflow Foundation