Jaa


Tracking Rules Execution Using SqlTrackingService

When rules execute they send out RuleActionTrackingEvent object as a user track point and various information could be sent to log file as well. Check Tracking and Tracing section in Jurgen Willis' "Introduction to the Windows Workflow Foundation Rules Engine" article here. SqlTrackingService by default tracks all user events (in addition to activity and workflow events) using a default workflow tracking profile created and stored in DefaultTrackingProfile table when you setup the SqlTrackingService. See the “Setup and Enabling SqlTrackingService” post here for information on how to setup and enable SqlTrackingService.

After setting up the SqlTrackingService, you can use the SqlTrackingService to track your RulesSet evaluation and it’ll do this by default. To retrieve information about the executed rules, you need to deserialize the data in UserEvent.UserData_Blob and cast it to RuleActionTrackingEvent.

The attached solution is a modification of SimplePolicy sample that utilizes SqlTrackingService to track rules execution and shows how to read the tracked rules from the SqlTrackingService database and writes the rule names and the condition results to console. It is built on WF Beta2.2.

Note that any workflow can send a user track point by calling this.TrackData()

SimplePolicyAndSqlTrackingServiceRulesTracking.zip