Avoid republishing your vocabularies and policies with the Business Rules Engine

Anyone who has ever worked with Business Rules and with the Business Rule Composer has had it’s share of problems when you want to perform a small modification to their policy or vocabulary.

Normally, when in production or QA phase, you would copy/paste your old version to a new version of the policy/vocabulary and then modify what was needed. The tool does not allow you to change already published policies or vocabularies. This to make absolutely sure that the same version of the policy/vocabulary would not result in different results.

Now this is all fine unless you are actually developing everything from scratch….
Now, most of the time you would work with a vocabulary and would build this along the way. Publishing a new version every time you add a new entry to your vocabulary is a common thing, but at the end of your work you end up with several versions (sometimes up to 10/20). This makes it quite difficult to maintain.
What makes it worse is that your rules depend on specific versions of your vocabulary…

At the end of your business rules development you would most likely want just one version of your vocabulary and one version of your ruleset (most likely v1.0).
This means that you would need to update all your rules and all your vocabularies which is again a very time consuming process.

Now, we found a little trick that enables you to “un-publish” a vocabulary and even a ruleset while you are developing them. Off course this is something you would only do while actually developing it from scratch. It would definitely be a bad practice to execute this on production vocabularies and/ or policies!!

Here’s how you do it for vocabularies:

  1. Publish your vocabulary and use it in your ruleset to test your rules.
  2. When you need additional changes to your vocabulary, go to “SQL Server Management Studio” and open the contents of the DB table “re_vocabulary” in the DB “BizTalkRuleEngineDB”.
  3. Check your vocabulary name in the “strName” column (second column in the table), together with the “nMajor” and “nMinor” columns which together make up your version number of your vocabulary.
  4. Once you found your particular vocabulary, set the “nStatus” column to 0 instead of 1 to “un-publish” your vocabulary.
  5. Reload your Business Rule Composer view (Press F5).
    Be aware that you need to be able to save your rulesets/vocabularies without errors to be able to do so.
  6. Perform the necessary changes to your vocabulary set…
  7. Republish, but not using the Business Rule Composer, but via setting “nStatus” to 1 again.

Although I know that this is not a best practice, it has really save me hours of work!

Be aware though, because there are some pitfalls:

  • If you add new items to your vocabulary, the above will work flawlessly.
  • If you edit existing items in your vocabulary, you will need to update your rules where you used the vocabulary with the “updated” vocabulary.
    I haven’t found yet why this is, but it can create some problems. They are easy to find though, since your friendly name will be replaced with an xPath function.
By the way: you can do the same for policies: take a look at the re_ruleset table in the same database (BizTalkRuleEngineDB)..
Advertisements