Introduction

In the ESB toolkit for BizTalk Business Rules can be used in the following scenarios:

  • Dynamic routing
    • Dynamically routes a message, based on the content of a known message type
  • Dynamic transformation
    • Dynamically transform a message from one type to another, based on the content of a known message type
  • Specifying Itineraries
    • Select an itinerary based on the content of a received message

It is not very difficult to create business rules policies in the Business Rule Composer that can be used for one of these scenarios but is not so easy to test the created policies because it’s not documented how to do it. You have to find out which specific classes, properties and methods are used and in which DLL libraries they are located. So I made %u200b%u200ba sample tool with which these ESB Toolkit classes can be tested! ( –;

 

Description

In the sample project is a Windows Forms Application located that calls the Business Rules Engine to test the business rules.

With the sample tool policies can be tested that have one of the following vocabularies from the ESB toolkit:

  • ESB.EndPointInfo
    • Set End Point Outbound Transport Location
  • ESB.TransformInfo
    • Set Transform Transform Type
  • ESB.Itinerary
    • Set Itinerary Name

 

Dynamic routing

Create a business rule in the Business Rule Composer that dynamically routes a message, based on the content of a known message type.

This example is based on: How to Implement Content-Based Routing Using a Business Rules Policy for a Known Message Type
See also:
http://msdn.microsoft.com/en-us/library/ff699643

 

 

How to test Content-Based Routing

Specify the following properties in the sample tool to test Content-Based Routing :

  • ESB Toolkit Fact: ESB.EndPointInfo
  • Policy Name where the specific business rules are located
  • Document Type of the message

 

Dynamic transformation

Create a business rule in the Business Rule Composer that dynamically transforms a message from one type to another, based on the content of a known message type

 

 

How to test Dynamic transformation

Specify the following properties in the sample tool to test  dynamic transformation:

  • ESB Toolkit Fact: ESB.TransformInfo
  • Policy Name where the specific business rules are located
  • Document Type of the message

 

Specifying Itineraries

Create a business rule in the Business Rule Composer That selects an itinerary

This example is based on: How to Select an Itinerary Using a Business Rules Policy
See also:
http://msdn.microsoft.com/en-us/library/ff699745

 

How to test Specifying an itinerary

Specify the following properties in the sample tool to test  selecting an itinerary:

  • ESB Toolkit Fact: ESB.Itinerary
  • Policy Name where the specific business rules are located
  • Document Type of the message

 

How the sample works

In the sample .NET application is a reference added to the Microsoft.RuleEngine.dll assembly, which contains the classes required to call the business rules engine. This may be in either $\Program Files\Common Files\Microsoft BizTalk or $\Program Files\Microsoft BizTalk Server 2010\.
Also are the necessary policy and fact objects created. Now the the business rule policy can be executed, as shown in the following listing:

 

Download

You can download the sample tool with the source code here:

http://code.msdn.microsoft.com/Testing-Business-Rules-in-28396b66