Jon Flanders' Blog

Yes - I still love Atlas

Tuesday, June 06, 2006 8:45:49 AM (GMT Standard Time, UTC+00:00)

I have to give kudos to the ASP.NET Team.  I really love the Atlas programming model.  I'd like to tell you that my Atlas based Workflow Designer is ready - but it isn't.  But - I did re-build the WF WorkflowMonitor sample application tonight as an ASP.NET Atlas based application (oh - and I also did is as a non-Atlas based ASP.NET application for those of you that are still suck doing flicker-based PostBacks ;-)).

What is Workflow Monitor?  Well the Windows Workflow Foundation runtime will take advantage of a TrackingService  - if one is found inside of the WF runtime.  The runtime ships with a SqlTrackingService - which by default tracks all Activity events.  See my post on the WF forums if you have never gotten tracking up and running for the steps I think people should go through to get the zen of WF tracking - http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=438583&SiteID=1.

One of the coolest steps is to use the Workflow Monitor sample that ships with the WF SDK.  It is a Windows Forms application that will (assuming you are using the SqlTrackingService and have added your workflow assembly as a reference or into the directory where Workflow Monitor is running) show you what has executed in terms of your Workflows.  If you set the SqlTrackingService.IsTransactional property to false, you can even see this in semi-realtime as the SqlTrackingService will write each event to the database as it happens rather than batch them (all writes are done transactionally regardless of the IsTransactional property BTW).

Why is this cool?  Well - to me it shows off one of the big features of using WF - visibility.  You can even show this to your pointy-haired bosses and they might start to see the advantage of WF.  Here is a screen shot of Workflow Monitor in action:

 

So what's so cool here?  Well two of WF's major features are being emphasized.  First - Visibility (sometimes referred to as Transparency - I like the simplier term).  At runtime and after runtime we can actually *see* what our processes have done.  The second major WF feature displayed is the designer re-hosting inside of another application other than Visual Studio. Although the designer really plays into visiblity - the fact that we can host the designer in any application royalty free I think is a huge bonus feature of WF.  Oh - not to mention tracking and the capabilities of the out-of-box SqlTrackingService.

So given my recent perseveration with Atlas and the WF designer I thought - wow wouldn't that be a cool combination? Having the visibility into your WF processes for the masses - even those who don't have the WF runtime on their machines - or those who you don't want to have to deploy the Workflow Monitor sample (which could be made into a pretty deployable click-once application very easily).

So here we go - unlike last nights tease post - not only will I show you a Workflow Monitor application hosted in ASP.NET - I'll post the code as well.

So here is my version of the Workflow Monitor in ASP.NET (which at the designer level borrows alot of code from the Workflow Monitor sample just to keep it consistent with what people have become used to).  First let's look at the Atlas version.  Why an Atlas version?  Well first of all as I mentioned I think Atlas rocks.  But it rocks for a very good reason (and that reason isn't that pointy-haired bosses know the term AJAX now and think they are so cool because of that).

Atlas and Ajax is cool because is gives the user the best browser experience possible.  Clearly the smart-client experience is going to be superior.  But if you have to go with a browser only application - why not make that application as easy as possible to use - and as nice as possible to look at.  I think AJAX browser applications do do that better than non-AJAX ones, and I think that Atlas is a great framework if you are building ASP.NET applications.

So in the spirit of cross-browser love - I am going to show you all the screen shots in Firefox.  :)

Here is my atlas/ajax based Workflow Monitor application in Firefox:

 

This is the ASP.NET Workflow Monitor in Firefox, before any workflow has been selected from the list of tracked workflows in the GridView on the right side of the page (to make this managable for more than a demo you'd want to restrict the time-frame of the query for these instances or give the use the ability to restirct the query - you can find how to do that from the Workflow Monitor sample itself).  Once I select an workflow from the list of tracked workflows on the left - I get the following (because it is using Atlas and an UpdatePanel there is no post-back flicker - only the workflow image itself is being updated:

 

Again - I have to tip my hat to the ASP.NET team on the job they did on Atlas, I never would have believed I could just write my ASP.NET page using the declarative ASP.NET model, add a few extra declarations and have a cross-browser AJAX application. But I have to say wow - they did it.  My contribution to this demo pretty much pales in comparison to theirs.

So how does this code work?  Well quite a while ago I posted about hosting the WF desinger in ASP.NET using a control and a handler to render a workflow as an pure image.  The worklow designer (WorkflowView actually) makes this option availlable as a public method.  The post I made last night about a WF Atlas based designer is also based on that code - as is this code (for honest disclosrure I borrowed much of the Workflow Monitor code directly for the worklfow drawing and use of the tracking API).

All that really happens is that each time you select a workflow from the list in the right-side GridView, a post-back is done to the server.  On the server-side some code in the page executes and retrieves the tracked workflow from the SqlTrackingService Query API (the same code that the Workflow Monitor example uses) based on its InstanceId. That information (the SqlTrackingServiceInstance)  is stored in ASP.NET session.  The HttpHandler - once it gets a request from the current session uses the SqlTrackingService instance to generate the image for the current workflow (the code from Workflow Monitor already decorated the current worklfow with special glyphs or images based on the execution status).

Just like the in Windows Forms version, this version loads the workflow into the Workflow Designer, but unlike that version which shows the results to the screen, this version captures an image (you can do this from the Workflow menu in Visual Stuiod 2005 as well when you are designing a workflow).

In the Atlas version there is no flicker and the browser app appears fairly close to Workflow Monitor.  With a Atlas timer - you could replicate the Workflow Monitor fucntionality almost completely and always hightlght and select the most recent workflow.

Again - if you are unlucky enough to be stuck doing ASP.NET without Atlas - I built a version that removes all the Atlas references and tags, and does work - just looks pretty bad since there is lots of post-backs and white screens in the browser.   You can download - either version (or hey download both versions and see the beauty of atlas - and remember you have to download and install the latest version of atlas for this to work - as well as beta 2.2 of WF) :

AtlasWorkflowMonitor.zip (697.68 KB)

NonAtlasWorkflowMonitor.zip (292.61 KB)

If you are stuck not using Atlas - this might a good time to introduce your pointy-haird boss to AJAX.  I am sure you'll be using Atlas in a very short amount of time ;-)

 |  |    #    Comments [12]   Tracked by:
"Workflow Designer Hosting" (Eric Nelson - Development for .NET Framework 3.0 (W... [Trackback]
https://blogs.msdn.com:443/ericnel/archive/2006/09/21/764386.aspx [Pingback]
http://content-maven.com/articles/imgs/buymeridia.htm [Pingback]
http://frederickwehba.com/wp-content/image-headlines/dietpills.htm [Pingback]
http://smartsolutions.no/cmsimple/downloads/discountviagra.htm [Pingback]
http://blood-bowl.net/MBBL/reports/prescriptionphentermine.htm [Pingback]
http://miresearch.org/files/hydrocodone.htm [Pingback]
http://icebox.com/catalog/images/vicodin.htm [Pingback]
http://rightrainbow.com/archives/2004/ambien.htm [Pingback]
http://frederickwehba.com/wp-content/image-headlines/dietpillsphentermine.htm [Pingback]
http://leasefunders.com/resources/buyphenterminecheap.htm [Pingback]
http://cheapiso.com/images/genericviagra.htm [Pingback]
http://icebox.com/catalog/images/viagra.htm [Pingback]
http://spaceblue.com/lists/attachments/dietpillsphentermine.htm [Pingback]
http://jaimezollars.com/shop/images/buy-phentermine.htm [Pingback]
http://www.google.com/search?q=gldqftka [Pingback]
http://www.google.com/search?q=oheyrfep [Pingback]
http://www.google.com/search?q=hertmxlm [Pingback]
http://www.google.com/search?q=pvnafovw [Pingback]
http://www.google.com/search?q=hkwbouqh [Pingback]
http://www.google.com/search?q=tvbpygnp [Pingback]
http://www.google.com/search?q=rlbvpaud [Pingback]

Tuesday, June 06, 2006 6:21:46 PM (GMT Standard Time, UTC+00:00)
Very cool!

I'm working on a demo of WF and Atlas so this would be a great addition to the demo. I'm assuming I just need the designer control and visibility control projects and then I can copy what you did in the website to my own website project?

This definately make WF even cooler since you can visibly watch things execute instead of just waiting. :)
Tuesday, June 06, 2006 6:45:58 PM (GMT Standard Time, UTC+00:00)
Makes me want to sit through another one of your classes... Quite impressive. Looks like the WF team has a real connection with how people will employ WF & Design of those WF's out further up the stack to users.
Wednesday, June 07, 2006 4:56:18 AM (GMT Standard Time, UTC+00:00)
BTW - I got your sample working on my site and it is very cool. I do get an "object reference not set to instance of object" when I click on the wf image (and the gradient image is missing), but everything else works great!

Thanks!
Wednesday, June 07, 2006 5:08:02 AM (GMT Standard Time, UTC+00:00)
That's a bug :) Take the code out of the _im_Click method on the WorkflowVisibility control - that code is left over from another usage :)
Thursday, June 15, 2006 6:49:17 AM (GMT Standard Time, UTC+00:00)
I like it but isnt it too slow for production use ? Put it on a dual server with 500 workflows and it takes quite a few seconds to bring up a workflow.

Supose ok for some remote monitoring ..

Regards,



Ben
Thursday, June 15, 2006 8:10:00 AM (GMT Standard Time, UTC+00:00)
Not slow on my puny laptop Ben. But yes - it is just sample, one thing will speed it up when I add a Thread pool for the handler
Tuesday, June 27, 2006 1:46:12 AM (GMT Standard Time, UTC+00:00)
That is cool. But the problem is that if there are a lot of activities in the workflow with a complex structure, it will not easily to use. Maybe the best way is that there are image maps in the image of workflow. Then we can click the specified image map of a activity or other component of workflow in the right image panel to see its detail status or even do some modification.
Thursday, July 20, 2006 11:24:23 AM (GMT Standard Time, UTC+00:00)
I didnt get the WFTracking data base. Where i should get it
Thursday, July 20, 2006 2:35:15 PM (GMT Standard Time, UTC+00:00)
You have to create it using the information in the WF SDK
Wednesday, August 09, 2006 6:23:15 PM (GMT Standard Time, UTC+00:00)
If anyone gets this error:
Could not load file or assembly 'HostingWorkflowRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Or any similar error that doesn't make any sense, it is *likely* because they have run a "workflow" that emits data to the "tracking" database they are using, and that particular WF instancetype has an entry there.
Problem is, when you run the "test" it loads *all* the WF instances and if that "type" is not available, it reflects (I'm assuming) and when it can't find the type thru it's "search" it throws the above exception.

Two possible solution exist:
1) filter out the "request" for "instances" to ones that are available to the "monitor"
2) copy the EXEs/DLLs of any WF instance types that might exist in the tracking DB to the "bin" folder of the "monitor" and that will allow you to view it. - this is likely the easiest approach if you just want to get the monitor to work so you can have a "working version" to look at.
Wednesday, August 09, 2006 6:27:47 PM (GMT Standard Time, UTC+00:00)
You are correct Andrew - this is actually a general issue with reading from the WF tracking database- not particular to my sample but thanks for pointing it ou.
Thursday, November 02, 2006 10:23:42 AM (GMT Standard Time, UTC+00:00)
@echo off
echo Creating Tracking database...
Osql -S %COMPUTERNAME%\SQLExpress -E -n -i "Create_WFAtlasTracking.Sql"

echo Creating Tracking tables...
Osql -S %COMPUTERNAME%\SQLExpress -E -n -d WFAtlasTracking -i "C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\EN\Tracking_Schema.sql"

echo creating Tracking stored procedures...
Osql -S %COMPUTERNAME%\SQLExpress -E -n -d WFAtlasTracking -i "C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\EN\Tracking_Logic.sql"

echo Creating persistence tables...
Osql -S %COMPUTERNAME%\SQLExpress -E -n -d WFAtlasTracking -i "C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\EN\SqlPersistenceService_Schema.sql"

echo creating persistence stored procedures...
Osql -S %COMPUTERNAME%\SQLExpress -E -n -d WFAtlasTracking -i "C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\EN\SqlPersistenceService_Logic.sql"

Pause





--P.S.:
Create_WFAtlasTracking.SQL is create the database script.
All comments require the approval of the site owner before being displayed.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Navigation

Books

Courses

Search

Subscribe

  • RSS 2.0
  • Add to Windows Live button
  • Add to Google button
  • Add to MyMSN button
  • Add to MyYahoo button
  • Add to Bloglines button
  • Add to Newsgator button