How to: Route a Single Message to Multiple Recipients Using an Itinerary Routing Slip
Goal
This section demonstrates how to use the Designer domain-specific language (DSL) to create an itinerary that routes a message to three distinct recipients using a static resolver and the BizTalk Server FILE adapter.
In this How-to topic, you will complete the following steps:
Create an itinerary with three static resolvers to route messages to multiple recipients.
Test the itinerary using the Itinerary Test Client sample application.
Prerequisites
The procedures in this How-to topic require the completion of the Prerequisites for the Development Activities.
Steps
To create an ESB itinerary DSL model
In Visual Studio, open C:\HowTos\Patterns\Patterns.sln.
In Solution Explorer, right-click ItineraryLibrary, point to Add, and then click New Itinerary.
In the Add New Item dialog box, click ItineraryDsl in the Templates pane.
In the Name box, type RecipientList, and then click Add.
To configure the properties of the itinerary
In Visual Studio, click the design surface of RecipientList.itinerary. In the RecipientList Properties window, configure the following properties:
In the Model Exporter drop-down list, click XML Itinerary Exporter.
In the Extender Settings section, next to the Itinerary XML file property, click the ellipsis button (...).
In the Select XML File dialog box, in the File name box, type C:\HowTos\Itineraries\RecipientList, and then click Save.
Note
This step enables you to export the itinerary as XML to a local file location. By exporting an itinerary to a local file location, instead of to the itinerary database, enables testing of the itinerary using the ESB Test Client application. You will complete this process later in this How-to topic.
To define the structure of the itinerary
From the Toolbox, drag an On-Ramp model element to the design surface. In the OnRamp1 Properties window, configure the following properties:
Click the Name property, and then type ReceiveNAOrder.
In the Extender drop-down list, click On-Ramp Extender.
In the BizTalk Application drop-down list, click Microsoft.Practices.ESB.
In the Receive Port drop-down list, click OnRamp.Itinerary.
From the Toolbox, drag an Itinerary Service model element to the design surface, and then place it to the right of the On-Ramp model element. In the ItineraryService1 Properties window, configure the following properties:
Click the Name property, and then type RouteToThreeRecipients.
In the Itinerary Service Extender drop-down list, click Messaging Extender.
Note
This property defines that the process will take place in a pipeline (messaging). Alternately, if the process will take place in an orchestration, set the Itinerary Service Extender property to Orchestration Extender.
In the Container drop-down list, expand ReceiveNaOrderDoc, and then click Receive Handlers.
In the Service Name drop-down list, click Microsoft.Practices.ESB.Services.Routing.
Right-click the Resolver collection of the RouteToThreeRecipients model element, and then click Add new Resolver. In the Resolver1 Properties window, configure the following properties:
Click the Name property, and then type FirstResolver.
In the Resolver Implementation drop-down list, click Static Resolver Extension.
In the Transport Name drop-down list, click FILE.
Click the Transport Location property, and then type C:\HowTos\Out\First%MessageID%.xml.
Note
You have added the first of three resolvers for this itinerary service. You will now add two more resolvers to route the message to additional recipients.
Right-click the Resolver collection of the RouteToThreeRecipients model element, and then click Add new Resolver. In the Resolver1 Properties window, configure the following properties:
Click the Name property, and then type SecondResolver.
In the Resolver Implementation drop-down list, click Static Resolver Extension.
In the Transport Name drop-down list, click FILE.
Click the Transport Location property, and then type C:\HowTos\Out\Second%MessageID%.xml.
Right-click the Resolver collection of the RouteToThreeRecipients model element, and then click Add new Resolver. In the Resolver1 Properties window, configure the following properties:
Click the Name property, and then type ThirdResolver.
In the Resolver Implementation drop-down list, click Static Resolver Extension.
In the Transport Name drop-down list, click FILE.
Click the Transport Location property, and then type C:\HowTos\Out\Third%MessageID%.xml.
In the Toolbox, click Connector. Drag a connection from the ReceiveNAOrder model element to the RouteToThreeRecipients model element.
From the Toolbox, drag an Off-Ramp model element to the design surface, and then place it to the right of the RouteToThreeRecipients model element. In the OffRamp1 Properties window, configure the following properties:
Click the Name property, and then type SendThreeMessages.
In the Extender drop-down list, click Off-Ramp ESB Extender.
In the BizTalk Application drop-down list, click GlobalBank.ESB.
In the Send Port drop-down list, click DynamicResolutionOneWay.
From the Toolbox, drag an Itinerary Service model element to the design surface, and then place it between the RouteToThreeRecipients model element and the SendThreeMessages model element. In the ItineraryService1 Properties window, configure the following properties:
Click the Name property, and then type SendPortFilter.
In the Itinerary Service Extender drop-down list, click Off-Ramp Extender.
In the Off-Ramp drop-down list, expand SendThreeMessages, and then click Send Handlers.
In the Toolbox, click Connector. Drag a connection from the RouteToThreeRecipients model element to the SendPortFilter model element.
In the Toolbox, click Connector. Drag a connection from the SendPortFilter model element to the SendThreeMessages model element.
To export the model for use with the Itinerary Test Client
In Visual Studio, right-click the design surface of the RecipientList itinerary, and then click Export Model.
Note
The XML version of the itinerary opens in Visual Studio.
Save all project artifacts.
In Windows Explorer, browse to C:\HowTos\Itineraries, and then notice the creation of your itinerary XML (RecipientList.xml).
To test the itinerary
Open the Itinerary Test Client sample application using the shortcut created during the Prerequisites for the Development Activities (C:\HowTos\ESB.Itinerary.Test.exe - Shortcut).
In the Itinerary Test Client, clear the Use WCF Service check box, and then click Load Itinerary.
In the Open Itinerary File dialog box, browse to C:\HowTos\Itineraries. Select RecipientList.xml, and then click Open to load the itinerary.
Click OK to clear the "Itinerary Loaded Successfully: message.
In the Itinerary Test Client, click the ellipsis button (...) next to the Load Message box.
In the Select XML Document to load dialog box, browse to C:\Patterns. Select NAOrderDoc.xml, and then click Open to load the test message.
Click the Submit Request button. When the test completes, click OK to dismiss the confirmation that appears.
In Windows Explorer, browse to C:\HowTos\Out\. Verify that the following messages have been written to the directory:
First%MessageID%.xml
Second%MessageID%.xml
Third%MessageID%.xml
Additional Resources
For more information, see the following related topics: