Can you use Dynamic Send Port without Orchestration? Yes you can

Published on : Apr 19, 2007

Category : BizTalk Server

Saravana

Author

Dynamic send ports are used in situations, where you don’t know in advance the type of transport adapter to use to send messages to your trading partner. May be based on certain content in your message you need to make that decision at runtime to pick up the transport adapter. The below figure shows the configuration for a Dynamic One-Way Send port, you can see you only specify the Name and Pipeline details (you can specify some of the other properties like maps, filters, etc). send port properties
You can download this article as a PDF document Download now.
Example Scenario: Say you are receiving an order message as shown below, which contains the “From” and “To” information in the header. <Order> <Header> <From>me</From> <To>Contoso</To> </Header> <Body>………</Body> </Order> Based on the “To” (trading partner name) you need to pick up the appropriate transport (ex: Contoso = FTP, Northwind=HTTP). Dynamic Send port works very well with Orchestration, all you need to do is specify the following line inside your expression shape Port_1(Microsoft.XLANGs.BaseTypes.Address) = “http://www.tradingpartner.com/receive.ashx That’s all it requires to route the message to dynamic send port. BizTalk resolves the correct transport address from the URI you specified. (I put the following screen shot, so you know what I’m talking about) biztalk expression editor

Behind the Scene:

When you create a Dynamic Send Port from BizTalk management console and start it, in the background BizTalk creates subscriptions for all the adapters installed in your server. A query for subscription shows the following result. send ports list If you look at the expression used inside the subscription you’ll see it’s looking for 3 properties “OutboundTransportType” (HTTP,FILE,FTP etc), “SPID” (Send Port Id) and existence of “OutboundTransportLocation”. The below figure shows the expression used for SendPort4: HTTP send port http When the orchestration submits the message to the MessageBox it promotes these three properties in the message context, which then gets picked up by the corresponding Dynamic Send Port.

How to use Dynamic Send Port without Orchestration?

If you want to use Dynamic Send Port in a content-based routing scenario (aka Messaging-Only scenario) one option is to promote the 3 properties
  • OutboundTransportType
  • SPID
  • OutboundTransportLocation
somewhere in your receive pipeline using custom pipeline component and submit it to the message box, which will then be picked up by the corresponding Dynamic Send Port. The only problem with this approach is SPID (Send Port id) is a system generated value and it might differ from environment to environment.

So, what’s the best solution?

All you need to do is define a new FILTER in your Dynamic send port, example BTS.ReceivePortName == <<your receive port name>>. That’s all it requires. Now if you look at the expression for SendPort4: HTTP you can see it accepts 2 different conditions one with SPID OR the other other one with ReceivePortName. So, all you need to do now is promote the following properties somewhere in your receive pipeline and submit the message to the MessageBox.
  • ReceivePortName
  • OutboundTransportType
  • OutboundTransportLocation
Instead of ReceivePortName you can use whatever promoted property you have in your system. Now, you know for sure those values are not going to change like SPID. outbound transport
You can download this article as a PDF document Download now.