BizTalk Pipeline Dreams, Part I
I think I've been suffering from "configuration envy." Looking at products such as WCF and the easy way you can build much of a service with a simple XML file, one begins to wish some of the older Microsoft products worked the same way. Take, for example, the BizTalk 2006 Pipeline Component.
Instead of baking the capabilities of a Pipeline into an assembly, wouldn't it be nice to configure a pipeline using an XML configuration file? Wouldn't it be great to augment a pipeline with a couple of managed classes? Wouldn't it be heaven to allow a BizTalk administrator to add or remove functionality?
I'm going to show you a XML configurable Pipeline Component prototype called the Pipeline Channel Stack I built to solve the problems above. Pipeline Channel Stack is built using ideas garnered from WCF. First, I'm going to give you an overview of the Pipeline Channel Stack. Then, I'll explain how the idea germinated and grew to use WCF ideas rather than WCF classes. I'll conclude with a deep dive into class implementation details.
Pipeline Channel Stack Overview
The Pipeline Channel Stack components are depicted in the following figure.
Figure 1. The Pipeline Channel Stack Components
The core pieces of the Pipeline are stored in the Flex_CustomPipelineCore.dll assembly. Flex_CustomPipelineComponent.dll is a Custom Pipeline Component. If Custom Pipeline Component development is new to you, you may find "Build BizTalk 2004 Custom Pipeline Components to Process Non-XML Data" helpful. Flex_CustomPipelineComponent_BizTalk is a BizTalk Pipeline.
For the sake of simplicity, going forward I'll refer to the stack of classes as the Stack.
When the Pipeline is activated, activation trickles down to the Flex_CustomPipelineCore.dll, which builds a stack of classes to execute the functionality of the pipeline. PipelineBinding and PipelineBindingElements create the Stack and a message class is built from internal BizTalk data structures by the bottom-most class in the Stack and passed through to the topmost layers in the Stack. The class arrangements are depicted in the next figure.
Figure 2. Class arrangements within the Pipeline
The Pipeline Channel Stack gives a developer the following capabilities:
- Creating "one-off" pipeline solutions will not require a completely new Custom Pipeline Component. Implementing a couple of classes and adding the new functionality to the stack are the only requirements. You'll see how to do this later in the article.
- Creating a completely new Custom Pipeline also is not required. Simply create two new classes for the Stack and you'll effectively have a new Pipeline.
The Binding and BindingElement classes are dedicated to assembling the Stack. If you've used WCF, the arrangement will look familiar to you. In fact, I would like to share how WCF influenced the design, before diving into code.
From WCF Seeds an Idea Blooms
Building a Pipeline Component using WCF was my first notion. In fact, I built the first working prototype with WCF. The WCF prototype compiled with a lot of unimplemented code warnings, but it did work. The warnings were my first clue that something was wrong. My second clue was: I was working around WCF rather than working with WCF.
I realized that it wasn't WCF that I needed; rather, I needed to follow some of the WCF implementation and architectural patterns. If you're familiar with WCF, you'll recognize many of the class names and class functional philosophy.
I'm going to take you a little deeper starting where Pipeline Activation begins, in the Custom Pipeline Component code.