Archive for the ‘MS Business Rules Engine’ Category

Changing the refresh period for the Business Rules Engine

8 May, 2007

By default the MS BRE only refreshes rules sets and vocabularies every 60 seconds. This is fine for production environments but more than a little annoying for the typical  update/deploy/test cycle of rules development.

In particular you can come a cropper of this limit when writing unit tests that rely on rule policies. Typically in a unit test you’ll want to deploy a particular rule policy and then test against it, but with automated tests you’ll find you hit messages like ‘RuleSet not Deployed’ as the engine will not pick up the new policy quickly enough.

Thanks to my colleague Dan for pointing out the following changes. Firstly this period can be specified in the BTSNTSvc.exe.config configuration file for BizTalk. Add the following two sections:

section name=Microsoft.RuleEngine type=System.Configuration.SingleTagSectionHandler />

<Microsoft.RuleEngine PollingInterval=5/> 

However that isn’t enough, as this only changes the refresh period for rule policies executed by the BizTalk engine. To change the period for the rules editor, you also need to change the following registry key:


How to invoke static methods from the rules engine

8 May, 2007

A colleague pointed out a rather surprising tidbit about the BRE to me recently – that by default it is not possible to invoke static methods on .Net classes.

This caught me out and was not obvious to spot. I had various string constants defined in a .Net assembly and was comparing them to fields in a message instance, but finding that the comparison was failing. When I tested these rules using the Business Rules Composer it seemed these conditions were not even being tested!

The simple solution is a registry change, modifying the key:


and giving it a value of 1.