The Future of Work and Workflow - RMTT Slides and Code Samples

by bsatrom February 23, 2009 19:02

Well, the Rocky Mountain Tech Trifecta has come and gone, and I think the event was a big success. There was a great turnout, and some really useful sessions.

I was pleased to have a full house in my WF talk, and I hope that it was a useful time for those that chose to listen to me drone over the other available options. There was some good interaction and good questions, both during and after the talk.

If you were there, I'd love to hear your feedback, good or bad. I can take, and I'm always looking for tips on how a technical talk can be more useful. If you have unabashed praise, I like that too.

If you would like to have the slides, I've embedded those below, or you can download them here. I have some notes of many of the slides if you're interested in more detail than I shared in the presentation. There are also a few slides at the end on .NET 4.0 improvements to WF that I didn't get to during the talk.

If you would like the code and demos I used during the presentation, you can find everything in a single Zip here. Most everything you need to run the demos should be here, but you will need to create the persistence and tracking databases if you want to use those pieces. Also, you'll need to have MSMQ installed and running on whichever machine you plan to use for these demos. There's a Powershell script to create the queues in the ConsoleWorkflowServiceHost project if you want to try out the MSMQ features.

There's also some unit tests if you want to try things out independent of the web app. You'll need to stage some data, but that's pretty easy. You'll notice that I also added a Test file to test the Custom WF activities I created for this demo separate from the WF itself. This is something I only mentioned in passing in the talk, but it's worth checking out as it's a useful way to really test your custom activities.

If anything else is gnarly, feel free to drop me a comment here or an email and I'd be happy to help you out.

Tags: , , ,

net | rmtt | speaking | wf

Debugging Workflows: WF Tracing - When Nothing Else Works, Try This...

by bsatrom February 17, 2009 01:02

If you've spent any time with Windows Workflow Foundation, you probably know that every possible thing you can do to enable logging and tracing of your workflows at runtime (Tracking, logging, Tracing) can save your butt when you just can't seem to find out why the heck your workflow is sitting idle after you've just thrown a few hundred concurrent requests at it.

Tracking is pretty well documented, and I would highly recommend it, along with a Monitoring tool that gives you a view into tracking results without needing to write queries against the tracking DB (I'll cover some minor enhancements I made to this tool in another post). Not that it's really that difficult, it's just not worth your time to figure out the ins and outs of the Tracking DB schema when Microsoft plans to greatly enhance it in .NET 4.0. (along with providing Tracking data views in IIS, which will be fantastic.)

Logging, whether via Enterprise Library or another tool like Log4Net, is also pretty well documented. If you're using Workflow Services, you'd also be wise to use Service logging as another source for Workflow forensics. This is also well documented.

Tracing, on the other hand -- which I consider to be the last line of defense when WF Runtime seems fine, Tracking data is clean, but the WF isn't completing as expected and/ or you're seeing intermittent socket exceptions in the svclogs -- is not so well documented. Perhaps this is because it need not be documented as it is simple and I am daft.

In any case, I thought it might be helpful to expound upon a few of the entries I have seen regarding Workflow Tracing.

When I first looked into adding tracing to my Workflow Host, I found several articles that recommended the following code in config:

   1:  <configuration>
   2:    <system.diagnostics>
   3:      <switches>
   4:        <add name="System.Workflow LogToTraceListeners" value="1" />
   5:        <add name="System.Workflow.Runtime.Hosting" value="Verbose" />
   6:        <add name="System.Workflow.Runtime" value="Verbose" />
   7:        <add name="System.Workflow.Runtime.Tracking" value="Verbose" />
   8:        <add name="System.Workflow.Activities" value="Verbose" />
   9:        <add name="System.Workflow.Activities.Rules" value="Verbose" />
  10:      </switches>
  11:    </system.diagnostics>
  12:  </configuration>

 

I found one example of this on MSDN. The guidance is spot on, but it is missing a few lines that I think would be helpful for a developer at his or her wits end with WF who is just trying to get logging up and running. It goes without saying that "LogToTraceListeners" assumes that one or more trace listeners already exist in your config. They don't exactly tell you that, do they? What's more, the self-contained config above would lead one to believe that you're all set this with this block of code.

Not so. At bare minimum, you'll need to add at least one of the listeners below (unless you wanted to use the EventLog listener, but you get the idea):  

   1:  <system.diagnostics>
   2:      <switches>
   3:        <add name="System.Workflow LogToTraceListeners" value="1" />
   4:        <add name="System.Workflow.Runtime" value="Error"/>
   5:        <add name="System.Workflow.Runtime.Hosting" value="Error"/>
   6:        <add name="System.Workflow.Runtime.Tracking" value="Error"/>
   7:        <add name="System.Workflow.Activities" value="Error"/>
   8:        <add name="System.Workflow.Activities.Rules" value="Off"/>
   9:      </switches>
  10:      <trace autoflush="true">
  11:        <listeners>
  12:          <add name="ConsoleTraceListener" 
                    type="System.Diagnostics.ConsoleTraceListener" />
  13:          <add name="TextWriterTraceListener" 
                    type="System.Diagnostics.TextWriterTraceListener" 
                    initializeData="System.Workflow.Trace.log" 
                    traceOutputOptions="DateTime" />
  14:        </listeners>
  15:      </trace>
  16:    </system.diagnostics>

Obvious? Maybe, but it's easy to miss in a rush. If that's you, I hope this helped.

You might find that adding those two lines did nothing to fix your issue, in which case I might have something else for you to try. I' have seen in some cases where listeners are already set up for other parts of the system (WCF logging, for example) that the code above still won't work. If that's you, try this:

   3:    <sources>
   4:      <source name="System.Workflow">
   5:        <listeners>
   6:          <add name="System.Workflow" />          
   7:        </listeners>
   8:      </source>
   9:      <source name="System.Workflow.Runtime">
  10:          <listeners>
  11:            <add name="System.Workflow" />
  12:          </listeners>
  13:        </source>
  14:        <source name="System.Workflow.Runtime.Hosting">
  15:          <listeners>
  16:            <add name="System.Workflow" />
  17:          </listeners>
  18:        </source>
  19:        <source name="System.Workflow.Runtime.Tracking">
  20:          <listeners>
  21:            <add name="System.Workflow" />
  22:          </listeners>
  23:        </source>
  24:        <source name="System.Workflow.Activities">
  25:          <listeners>
  26:            <add name="System.Workflow" />
  27:          </listeners>
  28:        </source>
  29:    </sources>
  30:    <sharedListeners>
  31:      <add name="System.Workflow" 
                type="System.Diagnostics.TextWriterTraceListener" 
                initializeData="c:\logs\System.Workflow.trace.log"  
                traceOutputOptions="DateTime" />
  32:    </sharedListeners>
  33:    <switches>
  34:      <add name="System.Workflow.Runtime" value="Error" />
  35:      <add name="System.Workflow.Runtime.Hosting" value="Error" />
  36:      <add name="System.Workflow.Runtime.Tracking" value="Error" />
  37:      <add name="System.Workflow.Activities" value="Error" />
  38:      <add name="System.Workflow.Activities.Rules" value="Off" />
  39:    </switches>          

Notice that live 4 in the first example is nowhere to be found here. I found I didn't need it. You'll also note that I had to add a source and listener for each Namespace in System.Workflow that I wanted to trace. I can't say why this works in cases where existing sources cause the "LogToTraceListeners" switch to hit the fritz, but I thought it was worth sharing. If it gets you our of a jam, then I'm happy to have shared it.

Tags: , ,

wf | workflow

The Future of Work and Workflow - Speaking at the Rocky Mountain Tech Trifecta on Feb. 21st

by bsatrom February 06, 2009 19:02

If you've read this blog for any length of time where I've posted regularly, you'll know that I'm a pretty big wonk for composition, Composite Apps and all things assembled and reused over coding from scratch.

So it should be no surprise that I'm quite a fan of Windows Workflow Foundation (WF), the Chico Marx of the .NET Framework, underappreciated for it's elegance, simplicity and power to fundamentally change the way that applications are built in the future. Wait, that last part doesn't quite apply to a lesser-known Marx brother, but you get the idea.

I've been interested in WF (If you hear me speak about it, notice that I will never, ever call it "Dub-F." Can't do it.) from the beginning, and have spent the last four months swimming in the deep end with WF, building some key pieces of an integration layer for a payment processing system that Thought Ascent has been working on for some time. Over that time, I've discovered that WF really does have all of the potential I suspected it did, and then some.

WF is a platform that will change the way we look at building applications, and I think that WF is a great example of the kinds of technologies that will move us closer and closer to true composition of applications over the next 5-7 years. Of course, being a Workflow platform released in concert with a universal framework for building connected systems (WCF) and the UI framework of the future (WPF) sort of makes Workflow Foundation like the third member of Destiny's Child. Those other technologies were game changers from day one. WF has an uphill battle to fight for recognition and adoption, but I believe it's the game changer of the future.

Not that it's being ignored, I just think it's been undervalued in the past, typically met with comments from developers and architects like "I get how it works, I just don't see what it's for"or "what does this give me that I can't do myself with code?"

But I see that tone changing, with Microsoft putting a better and better case around Workflow though integration with key technologies, along with richer complimentary services and tighter integrations with WCF.

So why am I telling you all this?

As you may or may not know, the Rocky Mountain Tech Trifecta is coming up in Denver on February 21st. This event will bring together several experts in the world of .NET, SQL and Windows, along with a few wannabees like myself who will present on just about anything you could hope to hear about in a developers conference. And there will be some heavy hitters to be sure: Scott Hanselman, Paul Neilsen, Rob Bagby and others. I'm not worthy...

If you hadnt't guessed from the first paragraphs of this post, I'll be speaking on Windows Workflow Foundation. Here's the abstract for the talk:

The Future of Work and Workflow

Since .NET 3.0, Windows Workflow Foundation (WF) has lived in the shadow of its flashy framework companions WCF and WPF. Yet from the start WF has been, at its core, about new ways of creating durable applications and composable units of work, both of which have the potential to change the way that developers assemble solutions. In this talk, Brandon will cover some of the highlights and recent enhancements to WF (Creating workflow services with WCF and WF, Workflow Persistence and Tracking), tips and tricks for advanced workflow scenarios (using MSMQ with workflow services, custom activities, etc.), and a preview of some upcoming Workflow features in the 4.0 Framework.

If you're close to Denver and haven't signed up yet, you can sign up at www.rmtechtrifecta.com. And if you're planning on coming, drop me a line. It should be a fun day.

And if you're not planning on coming, look for slides and code here over the next few weeks.

Tags: , ,

architecture | speaking | wf | workflow

Powered by BlogEngine.NET 1.6.0.0
Theme by Mads Kristensen | Modified by Mooglegiant

About me

I am the Chief Architect for Thought Ascent, President of IASA Austin, and a software developer interested in agile, architecture, craftsmanship, ddd and a variety of other topics. Join me as I explore them here.