How to use Business Rules in the ESB Toolkit and test them with the BRE TestTool
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!
Using the Tool
With the sample Tool policies can be tested that have one of the following vocabularies from the ESB Toolkit:
- ESB.EndPointInfo
- Set the Outbound Transport Location properties of a Send Port.
- ESB.TransformInfo
- Set the Transform Type.
- ESB.Itinerary
- Set the Itinerary Name.
Specifying ItinerariesHow to dynamically select an itinerary based on the content of a received message and how to test it. |
Create a Policy with Business Rules which select an itinerary |
Create a Policy with the specific Business Rules in the Business Rule Composer which select an itinerary. |
This example is based on: How to Select an Itinerary Using a Business Rules Policy |
Using the Policy in a Receive Location |
Configure the Itinerary Selector pipeline component in a Receive Location to use a business rules policy to select the appropriate itinerary. |
|
How to test the PolicyOpen the XML file in the TestTool and specify the following properties:
|
|
Now you can test the policy. |
|
When you click on the “Test” button, the policy is executed against the BRE engine.
|
|
On the Trace tab are the Test results of the BRE engine displayed. On the Actions tab the resolved itinerary name. The resolved itinerary is displayed on the Itinerary tab. |
Dynamic TransformationHow to dynamically select a map based on the content of a message and how to test it. |
Create a Policy with Business Rules which select the map |
Create a Policy with the specific Business Rules in the Business Rule Composer which select the map. |
|
Using the Policy in an Itinerary |
Configure the properties of the Resolver to use a business rules policy to select the appropriate map. |
|
How to test the PolicyOpen the XML file in the TestTool and specify the following properties:
|
When you click on the “Test” button, the policy is executed against the BRE engine.
|
|
Dynamic RoutingHow to dynamically select a destination based on the content of a message and how to test it. |
Create a Policy with Business Rules which select the destination |
Create a Policy with the specific Business Rules in the Business Rule Composer which select the destination. |
This example is based on: How to Implement Content-Based Routing Using a Business Rules Policy for a Known Message Type |
Using the Policy in an Itinerary |
Configure the properties of the Resolver to use a business rules policy to select the appropriate destination. |
|
How to test the PolicyOpen the XML file in the TestTool and specify the following properties:
|
|
Downloads
You can download the sample tool with the source code here:
Testing Business Rules in ESB toolkit 2.1 for BizTalk 2010
Testing Business Rules in ESB toolkit 2.2 for BizTalk 2013
See Also
Read suggested related topics:
- BizTalk Server: ESB Survival Guide
- Implementation of Routing slip pattern using ESB Toolkit 2.1 and BizTalk Server
Another important place to find a huge amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk Server Resources on the TechNet Wiki.