Calling A Receive Pipeline Inside an Orchestration in BizTalk 2006

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 message of 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:

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.

This article is part of the GWB Archives. Original Author: Stephen W. Thomas

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.