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.

2 Comments:

  • This blog is awesome full of usefull information that i was in dire need of.

    By Anonymous Gadgets UK, at 9:46 AM  

  • Thanks you. Very good post.Unless they can offer a really compelling reason for users to come back, it will be the next Bebo, MySpace

    By Anonymous 10755GF, at 11:08 PM  

Post a Comment

<< Home