Thursday, June 08, 2006 - Posts

WF Tracking

Have you spent anytime with Windows Workflow's Tracking Services? I just finished spending the past view evenings trying to get up to speed for Tally's Code Camp, on July 17, 2006. I am sure there are going to be some questions about tracking, and luckily I found Moustafa Khalil Ahmed's blog which really helped me out. I wanted to share some info about tracking within areas that I struggled with and that were not to obvious.

TRACKING BACKGROUND:

Tracking is handled through the System.Workflow.Runtime.WorkflowRuntime. Custom services that inherit from System.WorkflowRuntime.Tracking.TrackingService are added to the hosting runtime just like any other service by using the runtime's AddService method.

Tracking Profiles can be customized to return what information is needed to be tracked.

  • Workflow Events
  • Activity Events
  • User Events

CUSTOM TRACKING SERVICES

To Building custom tracking services requires two things...

  • A custom Tracking Service object that inherits from the abstract class TrackingService
    • This is the service that is added to the workflow runtime
  • A Tracking Channel object that inherits from the abstract class TrackingChannel.
    •  Used to channel the tracked information back

BUILDING THE CUSTOM SERVICE

Override the TryReloadProfile function of the TrackingService object.

  • This function will be called by the runtime when changes are made.
  • This is also where code needs to be written for building a custom profile.

Override the GetTrackingChannel method of the TrackingService object.

  • This method is what passes the TrackingParameters to the TrackingChannel object

BUILDING THE TRACKING CHANNEL

Now for the TrackingChannel Object...

Override it's Send method

  • This is the method that passes the TrackRecord
    • The TrackRecord is built by the custom profile and holds the information about the workflow

Once the custom TrackingService is working, it can be customized even more to return exact information needed by the workflow host. Bottom line, tracking worklows is a must and should be considered part of building a workflow.

Happy Tracking!