Martijn's blog - E-Commerce, EAI, BizTalk and .NET

2006/04/25

Microsoft Business Rules Engine (MS-BRE) - XmlTrackingInterceptor

A lot of businesses have a need to prove what their software has done in evaluating certain requests from customers, such as loan applications, mortgage application, etc. Using the BRE, there's a few ways to accomplish this goal.

One of them is implementing an interface called the IRuleSetTrackingInterceptor. Implementing this interface consists of writing code for the following methods, then called by the BRE as it's executing a RuleSet:

  • SetTrackingConfig
    Sets the rule set tracking GUID and tracking configuration.
  • TrackAgendaUpdate
    Tracks updates to the rule engine agenda.
  • TrackConditionEvaluation
    Tracks the evaluation of rule conditions.
  • TrackFactActivity
    Tracks changes to working memory.
  • TrackRuleFiring
    Tracks the firing of a rule.
  • TrackRuleSetEngineAssociation
    Tracks the association of a rule set with a rule engine instance.
Once your custom implementation is done, you can associate the class with a RuleSet to be tracked by passing it from code when calling Policy.Execute, e.g.:
Policy executingPolicy = new Policy("My Policy", 1, 4);
executingPolicy.Execute((object[]) facts.ToArray(typeof(object)), interceptor);

After the BRE is done executing the specified Policy, the interceptor class has been called for each task and might contain valueable information as to the execution of the Policy.

The BRE supplies a standard implementation of IRuleSetTrackingInterceptor, called the DebugTrackingInterceptor. This interceptor is also used if you have any "Call Rules" shapes within your Orchestrations. It's the way for the HAT to enable viewing what went on within the business process, BRE wise.

The DebugTrackingInterceptor, however, uses a plain text file format, which can be cumbersome to parse using tools. I've implemented a Xml version, which can be downloaded here. Using it you can track the same information as the DebugTrackingInterceptor does, but in a Xml format.

3 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home