Migrating Business Rules Policies from BizTalk Server 2006/2006 R2 to BizTalk Server 2013 R2

Posted: February 4, 2015 in BizTalk
Tags: , , , , ,

Here’s a topic that, without any particular reason, I never or I rarely addressed in my blog: Business Rules Engine (BRE)

The goal of this post is not to explain BRE but since it’s the first time that I cover something related with this topic, let’s first make a small introduction and share some notes and personal opinions about it.

Business Rules Engine (BRE)

Business Rules Engine (BRE) is a run-time inference engine that can link highly readable, declarative, semantically rich rules to any business objects (.NET components), XML documents, or database tables. It can evaluates rules against facts and initiates actions based on the results of that evaluation. This an optional component that comes out-of-the-box with BizTalk Server that enable you to directly create, modify and isolate a sets of rules of business decisions (business rules). To be more accurate, since BizTalk Server 2004 version, Microsoft has introduced in the product the Business Rules Framework, a stand-alone application that consists of a number of modules, support components, and tools. The primary modules includes:

  • Business Rule Composer, a graphical user interface that enables developers, business analysts and administrators for constructing vocabularies and policies;
  • Rule Engine Deployment Wizard for export, import, deploy or undeploy vocabularies and/or policies created in the Business Rule Composer;
  • And the Run-Time Business Rule Engine that executes policies on behalf of a host application.

However, and in my opinion, this is the second BizTalk Server most misunderstood component only outweighed by BAM (Business Activity Monitoring). And one of the reasons “why?” Is that, Business Rule Composer is a tool initially designed for Business Analysts, or those responsible for the business, to create and update Business Rules at any time without affecting the code implemented by the developer team. In this perspective, or initial intention, the BizTalk Developer is not responsible to create Business Rules, because in reality he will often be unfamiliar with the business, but he will be able to use or reuse them (BR) in their orchestrations to support a variety of scenarios like: determine the execution path of a business process.

BRE-Business-Rules-Engine-Overview

But one of the problems is that Business Rule Composer is a tool unfriendly, or too complex, for Business Analysts, which forces:

  • The Developers to stay with the task of creating them
  • And to the Administrators to maintain them

With an unfamiliar tool (Developer are familiar with Visual Studio and Administrators with BizTalk Administration Console) and sometimes with unfamiliar terms (vocabularies, rules and policies) to accomplish that.

Despite this component has not suffer any radical changes since 2004, BRE is still a powerful feature in BizTalk Server and you can make amazing thing with it. Ricardo Torre mentioned in his series about BizTalk Server Tips that:

  • Business Rule Engine is a high performance engine to evaluate business rules even when compared with WF Rules
  • And that Business Rule Engine is a good way of to modularize the constantly changing business logic that is often developed inside Orchestrations, making changes a more smooth process since updating a policy to the latest version doesn’t require any downtime at all.

In fact the most common application of BRE is to isolate business rule, in a centralized manner, from the BizTalk applications making it eminently reusable in a simple and efficient manner. But what many people don’t realize is that we can do many more things with it, for example:

  • BRE can be used to store configuration data (or Application configurations), using a vocabulary, which is essentially parameters, or friendly names for the facts, that can be used within the execution of a rules policy. However the vocabularies can also be accessed from C# code and they can be a wonderful way to abstract facts from their implementation.
    • The Rule Engine Config Get Functoid, available in the BizTalk Mapper Extensions UtilityPack, allows you to obtain a definition value from a Vocabulary in the Business Rules Engine to be used inside your maps.

Before we went to the purpose of this post let me mention a particular note: Normally we have policies that consumes vocabularies to generate rules, however:

  • We can have simple vocabularies that are not consumed by any policy
  • Or we can have simple policies that doesn’t consume any vocabulary

This week I have the necessary to migrate a simple policy (without any vocabulary) from an old version of BizTalk (2006 R2) to BizTalk Server 2013 R2. So what is necessary to migrate this artifacts’? Do I need to recreate everything or are they compatible?

How to migrate Business Rules Policies from BizTalk Server 2006/2006 R2 to BizTalk Server 2013 R2

Well, as I mentioned earlier in this post, BRE doesn’t suffer any radical changes since 2004 therefore this is a very simple task to be accomplished. For that you just only need to use the Rules Engine Deployment Wizard tool to import from your older environment and export them into your new environment.

Exporting policy from BizTalk Server 2006/2006 R2:
  • Click “Start”, “Programs”, “Microsoft BizTalk Server 2006”, and then click “Business Rules Engine Deployment Wizard”.

01-BTS2006-Business-Rules-Engine-Deployment-Wizard

  • On the “Welcome to the Rules Engine Deployment Wizard” page, click “Next”.

02-BTS2006-Business-Rules-Engine-Deployment-Wizard-Welcome

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

03-BTS2006-Business-Rules-Engine-Deployment-Wizard-Deployment-Task

  • On the “Policy Store” page, from the drop-down lists, select an available SQL Server computer and database, and then click “Next”.

04-BTS2006-Business-Rules-Engine-Deployment-Wizard-Policy-store

  • On the “Export Policy/Vocabulary” page:
    • Select “Policy” option.
    • From the Policy/Vocabulary drop-down list, select the desired policy you want to export.
    • Click “Browse” to select the definition file path and name.
    • And then click “Next “

05-BTS2006-Business-Rules-Engine-Deployment-Wizard-Export-Policy-Vocabulary

  • On the “Ready” page, review the information, and then click “Next”.

06-BTS2006-Business-Rules-Engine-Deployment-Wizard-Ready

  • On the “Exporting Policy/Vocabulary” page, after export is completed, click “Next”.

07-BTS2006-Business-Rules-Engine-Deployment-Wizard-Exporting-Policy-Vocabulary

  • On the “Completing the Rules Engine Deployment Wizard” page, review the completion status, and then click “Finish”.

08-BTS2006-Business-Rules-Engine-Deployment-Wizard-complete

Importing policy to BizTalk Server 2013 R2:
  • In the BizTalk Server machine, press the “Windows key” to switch to the Start screen, type “Business Rules Engine Deployment Wizard” or “rules”, and then click “Business Rules Engine Deployment Wizard” option from the Search menu.

09-BTS2013R2-Business-Rules-Engine-Deployment-Wizard

  • On the “Welcome to the Rules Engine Deployment Wizard” page, click “Next”.

10-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-Welcome

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

11-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-Deployment-Task

  • On the “Policy Store” page, from the drop-down lists, select an available SQL Server computer and database, and then click “Next”.

12-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-Policy-store

  • On the “Import Rules Engine Policy/Vocabulary file” page:
    • Click “Browse” to select the definition file that we previous export from BizTalk Server 2006/2006 R2.
    • And then click “Next “

13-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-Import-Policy-Vocabulary-file

  • On the “Ready” page, review the information, and then click “Next”.

14-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-Ready

  • On the “Importing Policy/Vocabulary” page, after import is completed, click “Next”.

15-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-Importing-Policy-Vocabulary

  • On the “Completing the Rules Engine Deployment Wizard” page, review the completion status, and then click “Finish”.

16-BTS2013R2-Business-Rules-Engine-Deployment-Wizard-complete

Now if we access to the Business Rule Composer you will notice that your policy is published are ready to be deployed.

17-BTS2013R2-Business-Rules-Composer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s