Tuesday, July 29, 2008

Deploying Business Rules using C# in BizTalk 2006 R2

In one of my last project, I have been working extensively with the Business Rules Engine in BizTalk. This project contains some complex Federal/State/Company/ rules. Being a Health Management Care related project I have to deal with many issues like requirements, changing policies, rules scope to a certain type, etc.

Delivering this project took some time and effort.  Not only the requirements were *agile*, but trying to keep compliance with SOX laws was a challenge.  I can summarized all of the requirements to these 3:

Requirements:

  1. Policies have to be atomic (independent from changes to other policies)
  2. Versionning of policies and being able to execute ANY version, any time.
  3. Need to know which facts were used to determine an outcome.

For the main requirement, I have created a Master Rule that determine the outcome, then I've created several *supporting* rules that will help me determine which of the rules were evaluated. The versionning requirement was already implemented by the BRE in BizTalk.

a sample of this would be something like this:

image

It quickly became very obvious that I have to deal with lots of policies and vocabularies.  If you ever tried using the Rules Deployment Wizard, you will see that it only allows you to export a SINGLE policy at a time.  Having over 500+ policies and over 30+ vocabularies  was not going to work out.

I have found the DeployRules.exe application written by Sreedhar Pelluru from Microsoft.  Here is the original article.  I took his program and modified to meet my needs.  Since I was only testing a set of policies at a time (i.e. Federal policies only), this tool provide me the ability to only load those policies that were relevant to the type I was working on. 

I know I have learned a lot about the BRE api from reading his well documented code.  With his permission, I have posted his original work and the modifications done to it back to the community at http://www.codeplex.com/DeployRules.  Yes it is still a work in progress.

Hope this help someone out there.

3 comments:

Anonymous said...

There is no download at http://www.codeplex.com/DeployRules. But I was able to download from the original post site which do not have any changes you made to this program.

Ensing said...

Check out the Rule Manager that does some realy cool stuff with biztalk rule policies. Rule documentation, Vocabulary management, and there is also some cool animation on rule dependencies.

Kian, Ting said...

I have also created a tool to mass export and mass import business rules , you can get it at https://github.com/kianting/biztalk-rules-export