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

Posted at: 4/19/2007 at 8:59 PM by saravana

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).

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) 

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.

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

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.

Nandri!

Saravana

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags: | |  Categories: BizTalk General
Actions: Email this article Email | Kick it! | DZone it! | Save to del.icio.us | Technorati Links
Post Information: Permanent LinkPermalink | CommentsComments(12) | Comments RSS

Comments

Tuesday, May 22, 2007 9:51 AM
Andy
Andy
Saravana,
Great blog and exactly what I want to do.... however I am having some problems... Could you clarify what you mean by

"So, all you need to do now is promote the following properties somewhere in your receive pipeline and submit the message to the MessageBox."

Do I need to write a custom pipeline? or can I promote the properties in my source or destination schemas????

Basically the error I am getting is that there are no subscribers to my message.

Many thanks
Andy
Tuesday, May 22, 2007 10:48 AM
Saravana Kumar
Hi Andy,
You can promote the required properties using your schemas (promoted schemas) and just use XmlDisassembler on the receive side to promote it. There is no special necessity to use custom pipeline component.

Cheers,
Saravana
Thursday, July 19, 2007 7:53 PM
Anonymous
Anonymous
Saravan, I have a question.

Can I promote those properties inside my custom send pipeline.


thanks
Jay
Thursday, July 19, 2007 7:54 PM
Saravana Kumar
Yes you can, using inmsg.Context.Promote method

Regards,
Saravana
Thursday, July 19, 2007 8:01 PM
Anonymous
Anonymous
That was a very quick response.

Thanks a lot..

one more question (sorry to bug you)

Can you please tell me How I can access a promoted field (from my message) inside a custom pipeline..I need that to configure this dyn send port
Thursday, July 19, 2007 9:25 PM
jay
jay
Sarvana lookslike promoting in the Send pipeline doesnt work.

I did following in the send pipeline:

inmsg.Context.Promote("OutboundTransportType", "schemas.microsoft.com/.../system-properties" rel="nofollow">schemas.microsoft.com/.../system-properties", "SMTP");
inmsg.Context.Promote("OutboundTransportLocation", "schemas.microsoft.com/.../system-properties" rel="nofollow">schemas.microsoft.com/.../system-properties", "Noreply@reply.com");

and also there is a subcription on dyn send port bts.receiveportname....

this didnt work..but when I promoted the properties in my receive pipeline it worked perfectly..

but I cannot do that in my receive port.is there any way to achive this..
Friday, July 20, 2007 7:41 AM
Saravana Kumar
To read the property, its same logic

inmsg.Context.Read()

I'm sorry I didn't read your first question properly. You won't be able to promote it in the send pipeline, because the message has already left the message box and all the subscriptions are evaluated by the time the message has reached the send pipeline.

I don't think you have any other option apart from fitting the promoted properties in you Receive Pipeline.

Can you tell me why you can't add it in the receive side? probably I can suggest an alternative solution there.

Saravana
Friday, July 20, 2007 11:00 PM
Jay
Jay
thanks saravana.

instead of dyn send port, I am using static send port (i didnt thought about this initially).

but I have set toaddress, subject etc inside my send pipeline..values comes from the send message..these are distinguished fields

this worked when i used context based routing but when I have an orchestration and a map..
Iam trying to access the distiguished fields on the destination message in send pipeline

but distinguished properties disappears when the message reaches send pipeline. do you know why???

Hope I didnt confuse you with this long message Smile
Tuesday, October 09, 2007 9:47 AM
Subbu
Subbu
Saravana,
Iam trying to get Oracle Adapter as dynamic send port.Is it possible to do this?
Second question is how to get FTP folder name for receive location inside the orchestration?

Thanks
Tuesday, March 18, 2008 9:26 AM
Sridhar
Hi Saravana,

Can we have dynamic send port for MQ series adapters ?

Regards,
Sridhar
Thursday, May 01, 2008 4:28 PM
lj
lj
I like the Nandri.. Hats off to your love for mother tounge Smile
Tuesday, July 08, 2008 9:03 PM
Anupama
Hi Saravana
I am trying to a send port with a promoted property as part of the folder name. Should I create a static or dynamic port and how do I access the promoted property?

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading