The Microsoft BizTalk ESB Toolkit extends the capabilities of BizTalk Server to support a loosely coupled messaging architecture. This article demonstrated how to implement routing slip pattern using BizTalk ESB Toolkit 2.1 and Business rules policy on top
of BizTalk Server 2010.
Routing slip pattern describes a scenario where we route a message consecutively through a series of processing steps when the sequence of steps is not known at design-time and may vary for each message.
Business Case: XML messages pertaining to Employee schema are picked by BizTalk from a specified file location and routed through a series of processing steps (Itinerary) based on the value of department. For example if the department is
‘Admin’ then ‘ForAdmin’ itinerary will be selected and if ‘HR’ then ‘ForHR’ itinerary will be selected.
Solution Walkthrough: This solution consists of following artifacts:
Following steps need to follow to develop the BizTalk solution:
1. Open BizTalk Administrator console and create an application named “ESBSamples”. Add a reference of the application “Microsoft.Practices.ESB” to the ESBSamples project.
Note: Microsoft.Practices.ESB is the default application for ESB related artifacts which get automatically created during the configuration of ESB Toolkit 2.1
3. Create a Receive port ESBSample.OnRamp.Itinerary and a Receive location named
ESBSample.OnRamp.Itinerary.FILE and configure this as:
Receive Pipeline: ItinerarySelectReceiveXml having ItineraryFactKey = Resolver.Itinerary
ResolverConnectionString = BRI:\\policy=SelectItineraryBasedOnDept;useMsg=true;recognizeMessageFormat=true;
Here SelectItineraryBasedOnDept is the name of the Business Rule Policy which we will be creating from step- (8)
4. Now open visual studio 2010, create a blank solution named “Abhijit.ESBSamples”.
5. Add an Empty BizTalk Server project named “Abhijit.ESBSamples.Demo2.Schemas” and a BizTalk ESB Itinerary Designer named “Abhijit.ESBSamples.Demo2.Itinerary”.
6. Right click on the schema project and add a schema named Employee.xsd having following fields as shown below in the image:
7. After signing the project deploy it to application named “ESBSamples” the one we have created in step-1.
Create the Business Rule Policy:
8. Now open Business Rule Composer and create a policy named “SelectItineraryBasedOnDept”
9. In the SelectItineraryBasedOnDept policy, right-click and Add New Rule. Name the rule to ”SelectAdminItinerary”.
10. In Facts Explorer, click the XML Schemas tab, right-click Schemas, and then click browse
to Employee.xsd under the folder C:\C#\Abhijit.ESBSamples\Abhijit.ESBSamples.Demo2.Schemas\ and open it.
11. In fact explorer, click on Employee.xsd and change the Document Type property to
12. In the Rule window, right-click Conditions, point to Predicates, and then click
13. From Facts Explorer, drag the Department element to the
argument1 node under Conditions.
14. Click the argument2 node, and then type Admin.
15. From Facts Explorer, drag the Set Itinerary Name definition under the vocabulary
ESB.Itinerary to Actions.
16. Click and then type ForAdmin to <empty string>.
Similarly add one more rule named “ForHR” having following Conditions and Actions
is equal to HR
Set Itinerary Name to ForHR.
17. Publish and deploy the policy to Rule Engine database.
Create the “ForAdmin” Itinerary
18. Now switch to Visual studio solution and right click on Abhijit.ESBSamples.Demo2.Itinerary project and add an Itinerary named “ForAdmin.Itinerary”
19. Design the Itinerary as below:
Here first shape is the On-Ramp(RcvAdminEmployee) and for the properties of this refer the below image.
Last shape is the Off-Ramp(SndAdminEmployeeMsg) and for the properties of this shape refer the below image.
Other two middle shapes are Itinerary service, one is for Messaging Extender(SendToFile)
and other is for off-Ramp Extender(SetDestinationInfo).
For the properties of SendToFile shape, refer the below image
And for the properties of the Static Resolver used in the Itinerary service, refer the below image.
For the properties of off-Ramp Extender(SetDestinationInfo), refer the below image
20. Now Right-Click on the Itinerary designer and click on validate. You might get an error with description: A X509 Certificate is required in the model property ‘EncryptionCertificate’ to encrypt any sensitive property in the designer.
To get rid of this error you need to set the value of ‘Require Encryption Certificate’ to false.
21. Set the model exporter of the Itinerary as Database Itinerary Exporter and Itinerary status as Deployed.
22. Right-Click on Itinerary designer and click on Export model to store the Itinerary into
Create the “ForHR” itinerary
23. Design the Itinerary as below image
Configuration properties for each shape is similar to “ForAdmin” itinerary. Only difference is in value of the ‘Transport Location’ of the Static Resolver used in ‘SendToFile’ itinerary service.
Right-Click on Itinerary designer and click on Export model to store the Itinerary into
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.
Congratulations on winning a medal! blogs.technet.com/.../technet-guru-awards-june-2013.aspx
Thanks Ed Price!!
One of few ESB related articles on Wiki.