Geeks With Blogs
Arnoud's blog

A new feature in Biztalk 2006 is the calling of a pipeline from within an orchestration. In 2004 when you wanted to envelope a message and use the enveloped message in that orchestration you would have to use an outgoing message to a port (so send the message out of Biztalk) and receive it back into your orchestration. This off course is not a very performant way of enveloping a message. You would probably use some kind of helper function to do the trick, which is sort of ok but it's still a pitty you weren't able to use the Biztalk message handling capabilities for this.

Biztalk 2006 offers you a way to perform pipeline like message handling form within an orchestration. So you are now able to route a message through a pipeline without having to route the message away from Biztalk or use a utillity.

Send pipeline

The code below shows you an example for executing a send pipeline. In this case only one message gets enveloped. The code has to go into a message assignment shape for it creates the EnvelopedProductOut message.

//Init pipeline output
EnvelopedProductOut = null;

//Zet de product message in de input van de pipeline


First the output for the pipeline is initialised. Next the message to be enveloped is added to pipeline input (ProductPipeMsg). This pipeline input takes the form of an orchestration variable of type Microsoft.XLANGs.Pipeline.SendPipelineInputMessages and can be used as a buffer for messages to route through the pipeline. In the sample code only one message is added before the pipeline call. As the SendPipelineInputeMessages class can be persisted, it will retain it's state after for example a dehydration of the orchestration. If this wasn't the case calling a sendpipeline would not be usefull.

After adding the message to the pipeline input the pipeline call is made. The ExecuteSendPipeline method is called on the XLANGPipelineManager supplying the type of the pipeline to use, the pipelline input and the resulting Biztalk message. In the sample a custom pipeline is used (Sample.EnvelopePipeline) which envelopes the input in a specific envelope.

It can be usefull to put the entire send adapter call (and maybe related things) in a seperate scope, the sample that is supplied in the Biztalk 2006 SDK implements the call in a scope. For a call to a send adapter it is not necessary to use a transactional scope.

Every message that is added to the pipeline input is enveloped into a single message. So you can use this technique to aggregate messages into a single message quit easally. However as I mentioned earlier the state of the pipeline input is persisted in the Biztalk database. If the number of messages you want to aggregate becomes large or you have large messages you want to aggregate you might want to use a different approach because the sheer size of the state Biztalk will try to persist will degrade performance.

Receive pipeline

For calling a receive pipeline the same references need to be added to your Biztalk project.

The execution of a receive pipeline must be done within an atomic scope. This is caused by the pipeline output (Microsoft.XLANGs.Pipeline.ReceivePipelineOutputMessages) which cannot be persisted by Biztalk. In the atomic scope you first execute the receive pipeline by putting the code below in an expression shape.

pipelineOutput = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(Sample.ReceivePipeline), EnvelopedProductIn);

In this sample the EnvelopedProductIn is the Biztalk message you wish to route through the pipeline. The Sample.ReceivePipeline is the type of a custom pipeline that removes the envelope from the EnvelopedProductIn.

Next you need a message construction shape to create, in this case, de-enveloped messages. The Message Assignment shape reads the messages from the output. The sample below creates an message of type ExtractedMessage from the pipeline output.

//Initialize the message to extract
ExtractedMessage = null;

//Move the enumerator for the pipeline output to the next message

//Get the message from the output

The MoveNext on the enumerator needs to be executed always, the enumerator will not automatically be on the first message after pipeline execution. Typically you would call the code above in some kind of loop to process every message in the output.


Biztalk 2006 provides an easy way to call (custom) pipelines which can be very usefull in for instance enveloping en de-enveloping messages or aggregating messages (enveloping of multiple messages). The scenario's that come to mind are the excution of (small) multidocument batches from within an orchestration or the routing of untyped messages through Biztalk.

The implementation of batching using the pipeline call should, in my opinion, be limited to batches of small number of messages. A large number of messages would stress the Biztalk server unnecessarily. I already mentioned the state persistence problem of the send pipeline input. But also in batching a receive input containing a large number of messages can in my view better be solved otherwise.


Posted on Wednesday, February 15, 2006 4:52 AM | Back to top

Comments on this post: Calling a pipeline from within an orchestration in Biztalk 2006

# re: Calling a pipeline from within an orchestration in Biztalk 2006
Requesting Gravatar...
Is it possible to execute FFA pipeline from orchestraion, and retain the raw/ff message?

In other words will Assemble stage be excluded from execution with in Orch?
Left by Abhijeet Raje on Apr 27, 2006 6:59 AM

# re: Calling a pipeline from within an orchestration in Biztalk 2006
Requesting Gravatar...
The composed message processor sample in the Biztalk 2006 SDK should help you with this.
Left by Arnoud on May 12, 2006 9:29 AM

# re: Calling a pipeline from within an orchestration in Biztalk 2006
Requesting Gravatar...

nice article, really help to grasp idea about pipeline calling.

well done, and keep sharing your thoughts.


Left by Genious on Jul 20, 2007 5:39 AM

# re: Calling a pipeline from within an orchestration in Biztalk 2006
Requesting Gravatar...
Very helpful info!

I'm using this approach and composing a flatfile batch message in my orchestration. Now, I want to add a flatfile header message to it. How can I do this?

The composed message processor seems to add a header to it's output message but I do not see where/how it happens.

Thanks for your help!!
Left by biztalker on Oct 05, 2007 4:55 PM

# re: Calling a pipeline from within an orchestration in Biztalk 2006
Requesting Gravatar...

when I am trying to deploy the send pipeline i am receiving the following error.
There was a failure executing pipeline "CCX.BizTalk.USBank.Pipelines.SendEDI270". Error details: "Specified method is not supported.".

Do you have any idea about this?

Left by Harish Neelakantan on Feb 21, 2011 4:27 PM

Your comment:
 (will show your gravatar)

Copyright © Arnoud Lems | Powered by: