Testing ESB Toolkit 2.1 Business Rules for BizTalk 2010

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 ​​a 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.
image
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
image

 

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
image

 

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
image

 

Specifying Itineraries

Create a business rule in the Business Rule Composer That selects an itinerary
image
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
image

 

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:

Code

 

Download

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

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

About the author

Tomasso Groenendijk lives in Netherlands and is a senior integration consultant at Motion10. He has over 15 years’ experience in software development and software design. Tomasso is specialized in application integration with a strong interest in the Windows Azure cloud platform. In 2014, 2015 and 2016 Tomasso was awarded with the Microsoft Azure MVP award. He is an active contributor to the integration community through his work on his blog, MSDN samples, TechNet Wiki and also speaking on events.

 
 
 
MVP profile Tomasso Groenendijk
 
 
Sentinet Product Specialist
 
 
BizTalk360 Product Specialist

Month List