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.
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.
Step No 2
On the Deployment Task page, select “Export Policy/Vocabulary to file from database”, and then click Next.
Step No 3
On the Policy Store page, select the “SQL Server Instance” and the “Configuration Database”. Click Next to continue.
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.
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.
Step No 6
If the export is successful, the following success message will be displayed. Click Next.
Step No 7
Click Finish to exit the wizard.
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:
- Connects to a Rule engine database
- Loads Policies from the Rule engine database and exports them to a folder
- 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
How to Load Policies from the Rule engine database and export it to a folder
How to Load Vocabularies from the Rule engine database and export it to a folder