With the release of BizTalk 2006 Beta just around the corner, why not get a head start by seeing how to call a Receive Pipeline from within an Orchestration.



For starter, why would you want to call a Receive Pipeline from within an Orchestration? I had to struggle for a bit to come up with a good reason… I can find it useful in debatching Scenarios that require mapping prior to debatching or for debatching into smaller batches using a map. I could also find it useful when working with flat file.



Limitations: Calling a Receive Pipeline inside the Orchestration does not support recoverable interchanges (more on this later) and it must be run inside an Atomic Scope.



Super Cool: Supports receiving multiple messages returned from the pipeline and can use enumeration to process each message.



The sample shown below receives a messageof type XmlDocument into the Orchestration. A Receive Pipeline is called to Debatch the message using an Envelope Schema. A loop shape is used to enumerate over the resulting messages and send each single message. In addition, references are needed to Microsoft.XLANGs.Pipeline and


Microsoft.BizTalk.Pipeline.




The CallPipeline Expression Shape contains the following line of code:


InputPipeline = Microsoft.XLANGs.Pipeline.


XLANGPipelineManager.ExecuteReceivePipeline


(typeof(CallReceivePipeline.ReceivePipeline),msgFullMessage);



With InputPipeline defined as an Orchestration Variable of type Microsoft.XLANGs.Pipeline.ReceivePipelineOutputMessages



GetEachMessage will loop the collection using MoveNext like this:


InputPipeline.MoveNext()



Finally, the single messages are assigned inside the Message Assignment shape like this:


msgSingle = new System.Xml.XmlDocument();
InputPipeline.GetCurrent(msgSingle);



With msgSingle defined as an Orchestration Message of a specific schema type.



It is that simple! In about 5 lines of code the Receive Pipeline can be executed inside on Orchestration in BizTalk 2006!



Download: Sample Receive Pipeline in BT2006



Do not forget to view all my other samples at http://www.biztalkgurus.com



Please note this sample is based on pre-beta code (CTP Build) of BizTalk Server 2006. This may not work on other builds, RTM, etc.



If you do not have Visual Studio 2005 Beta 2 and BizTalk 2006 installed you can still download and view the artifacts (like the Orchestration). You will not be able to open the project or run the sample.