Introduction

Working as a BizTalk Administrator and managing BizTalk testing environments is the basis of this blog. There are two testing environments, the first environment is called the Test environment which contains two servers. One for BizTalk and the second for its database. The second environment is called Staging, which is a clustered environment with six BizTalk Servers, and two more servers for its database. BizTalk applications are initially deployed in the Test environment where testers do the initial testing. Once the testers are satisfied, the code is moved to Staging for another round of testing.

Problem

Deployment of BizTalk Applications on a clustered and multi-server environment can sometimes become very challenging if the process is not automated. Exporting the BRE Policies and Vocabularies from the Test Environment and importing them to the Staging Environment can be extremely tedious. BizTalk provides a tool for this purpose, called the “Business Rule Engine Deployment Wizard”.

The problem with the wizard is that it can only work with one policy at a time or one vocabulary at a time. It does not support bulk operations.

Below are some screenshots of the wizard to explain the process of exporting just one vocabulary:

Exporting Vocabulary using Business Rule Engine Deployment Wizard

Step No 1

Launch the “Business Rule Engine Deployment Wizard” on the Welcome page, click Next.

Export-BRE (1)

Step No 2

On the Deployment Task page, select “Export Policy/Vocabulary to file from database”, and then click Next.

Export-BRE (2)

Step No 3

On the Policy Store page, select the “SQL Server Instance” and the “Configuration Database”. Click Next to continue.

Export-BRE (3)

Step No 4

On the Export Policy/Vocabulary page, click Vocabulary, and then select your required vocabulary to export in the Policy / Vocabulary list, click Next.

Export-BRE (4)

Step No 5

On the Ready page, the wizard will display your specified settings from the previous screens for confirmation. Review your settings, and click Next to start the export process.

Export-BRE (5)

Step No 6

If the export is successful, the following success message will be displayed. Click Next.

Export-BRE (6)

Step No 7

Click Finish to exit the wizard.

Export-BRE (7)

Solution

As shown in the previous section, exporting a single BRE Vocabulary is a time consuming task and there are many steps involved in the process. When importing several policies or vocabularies, it becomes very tedious. To automate the process a utility written in C# called “PolicyExporter” has been created. The utility does the following tasks:

  1. Connects to a Rule engine database
  2. Loads Policies from the Rule engine database and exports them to a folder
  3. Loads Vocabularies from the Rule engine database and exports them to a folder

Use the Microsoft Rule Engine class library to connect to the Rule engine database and load the required policies or vocabularies. For this, the first step is to add reference of Microsoft.RuleEngine.dll assembly in your project. The assembly resides on the BizTalk Server at C:Program Files (x86)Common FilesMicrosoft BizTalk.

Feel free to use the following code in any of your applications:

How to connect to a Rule engine database

Export-BRE (8)

How to Load Policies from the Rule engine database and export it to a folder

Export-BRE (9)

How to Load Vocabularies from the Rule engine database and export it to a folder

Export-BRE (10)