I’ve recently seen a query in the “Biztalk New Users” newsgroup someone asking the above question. I quickly did a search to find out if there is (are) a decent article out there explaining the difference and didn’t find any. I feel its quite important and basic thing every biztalk developer should understand, ofcourse we all learned this by experience, but for new comers it will be a big confusing point. So, let me put a short article here to explain the difference.
The above figure show the architecture for Biztalk 2004/2006 (I’m sure you would have come across this picture million times by now, I took it from MSDN). It shows clearly the only way messages can come in and go out of the message system via some kind of pipeline. So, whether you are doing any processing in the pipeline or not you need some default pipeline for the message to come in and go out of Biztalk.
Out of the box biztalk provides 2 Receive pipelines (PassThruReceive, XmlReceive) and 2 Send Pipelines (PassThruSend, XmlSend), ofcourse you can go and build more custom pipelines if required. For a detail understanding of pipelines read my white paper published by Microsoft.
Now, what’s the difference?
The default PassThruReceive and PassThruSend pipelines doesn’t do any processing at all with the message. You can treat them as if like no pipelines are present (virtually) inbetween the adapter and the message box. Wheareas the XmlReceive pipeline will have a XmlDisassembler pipeline component on the disassembling stage and the XmlSend pipeline will have a XmlAssembler on the Assemble stage as shown in the above figure.
Why do we need a XmlReceive pipeline:
As discussed earlier the only additional component in the XmlReceive pipeline when compared to PassThruReceive pipeline is the addition of XmlDisassembler pipeline component on the disassembling stage. Whenever an Xml message is received via the XmlReceive pipeline the XmlDisassembler will do the following tasks:
1.Promote the “MessageType” context property by taking the combination of TargetNamespace and Rootelement in the format, Targetnamespace#RootElement.
2. Remove Envelopes and disassemble the interchanges
3. Promote the content properties from interchange and individual document into message context based on the confirured distingushed fields and promoted properties.
See the link for detailed explanation of XmlDisassembler (http://msdn2.microsoft.com/en-us/library/ms964545.aspx).
There are 3 important things you need to keep in mind.
1. Maps on the receive side will be applied after the receive pipeline. In order to pick the correct schemas for processing, Maps need the “MessageType” property, which is promoted by the XmlDisassembler. So, if you are using PassThruReceive “MessageType” property won’t be present, which in turn will result in Map not being applied.
2. Binding of logical port (Activation port) in the orchestration to a message (inside the orchestration designer), and deploying/enlisting the orchestration will create the subscription for the particular message type. So, if you are using PassThruReceive “MessageType” property won’t be present, which in turn will result in not starting the particular Orchestration instance.
3. If you have configured content based routing based on the properties in the message (Filters in SendPorts, Example: BTS.MessageType = http://tempuri#Person), routing won’t happen until the correct properties are present in the message context.
Note: There are numerous ways in which you can make all the above 3 points work without XmlReceive pipeline, but they all requires some custom coding.
Is there any rule on the combination of Pipelines you can use on the Receieve and Send side?
Of course, NOT. There is no restriction on the type of pipeline combination you need to use on the Receive and Send side. For example: You can receive a message via XmlReceive pipeline and Send it thru PassThruSend pipeline, this applies to custom pipelines as well. In fact Biztalks pub/sub architecture doesn’t put direct connection (or in better terms won’t know) between the receive and send side.
Why do we need a XmlSend pipeline?
XmlSend pipeline does the reverse of what a XmlReceive pipeline did. It got a XmlAssembler component in the Assemble stage in addition to the PassThruSend pipeline, which does the following tasks:
1. XML Assembler Builds envelopes as needed and appends XML messages within the envelope.
2. Populates content properties on the message instance and envelopes.
See the link for detailed explanation of XmlAssembler http://msdn2.microsoft.com/en-us/library/ms964547.aspx
For beginners, you can skip all the points related to Envelopes and Interchanges mentioned above.