LinkedIn

Friday, 8 October 2010

Workflow 4.0 - Adding annotations to your workflow tracking profile

Lets say you have a workflow that is running on a DEV / TEST and LIVE server. Lets say, also for the sake of it, that we are using the same AppFabric database for all 3. (yes, this is not the best idea but to explain annotations it helps.)
So what we want to acheive is the show, in AppFabric monitoring, which server we are using. So the monitoring with show either:
  • ServerThatEmittedThis: DEV_Server
  • ServerThatEmittedThis: TEST_Server
  • ServerThatEmittedThis: LIVE_Server
Again, this example is useless in the real world but i'm sure by the end of this post you will be able to imagine some real world uses for this functionality.

So you can see that in my current tracking profile I have added an annotation of my DEV server as follows:

You can see in the pic. "ServerThatEmittedThis: DEV_Server" which will now show up in AppFabric monitoring.

So I will now run the workflow which is hosted in IIS / AppFabric. 

My workflow runs and is persisted into my persistence store. So I click on the Active or Idle Intance in my AppFabric dashboard:
Note I could also navigate to the annotated info if my workflow wasnt using a persistence store by Looking on the dashboard for the WCF Call History section and click on the link in the Completed Calls section.

Once I can see the instance I click to select view tracked events:
Once here, I can see all the events that my workflow has passed through. 
Note that I am using a custom tracking profile that emits less than some of the default profiles. My custom tracking profile named: ExpenseServiceTrackingProfile is shown in the first screen shot of a part of my web.config in this post.

As i placed my annotation in my web.config as a child node to the activityStateQuery named Screen Expense I know to expect to see my annotation in AppFabric at the point where my screen expense activity emitting its tracking record. 

As you can see from the above pic. I have clicked on the Screen expense item and at the bottom you can see a tab called "tracked variables" shown below:

So I know that the workflow (server) emitting this tracking record is from my dev server. 

Rubbish example, but  I hope you get the point.

R