PipelineTesting: Pre-built Pipelines and Messages

Link. July 25, 2007. Comments [0]. Posted in: BizTalk

Here are some more syntax examples for the new library version:

3. Using pre-built pipelines:

If you have existing, already compiled, BizTalk pipelines, I currently have two options for using them:

ReceivePipelineWrapper pipeline = Pipelines.NewReceive(typeof(MyPipeline));

Or:

ReceivePipelineWrapper pipeline = Pipelines.NewReceive<MyPipeline>();

4. Adding Document Specifications:

It's also important to add any necessary document specifications (schemas) to the pipeline before executing it so that disassembler and assembler components can find them. This is now possible as well during construction:

SendPipelineWrapper pipeline = Pipelines.NewReceive()
   .AddAssembler(new XmlAsmComp())
   .WithSpec<MySchemaType>()
   .End();

One thing I'm not quite sure about here is with the standard XML pipelines and prebuilt pipelines. For them, the current factory methods in the Pipelines class don't return a builder object (like the one returned by the empty NewReceive() and NewSend() methods I introduced last time), so if you want to add known document specifications to those, you still need to use the old AddDocSpec() method in the ReceivePipelineWrapper and SendPipelineWrapper classes. It's not much more complexity, but the asymmetry makes me dislike it a bit.

So I'll probably be changing the code so that all pipeline creation methods return builder objects and not the actual pipeline objects. Any objections?

5. Executing Send Pipelines:

One annoying part of the current API is that when executing Send pipelines you need to explicitly create a MessageCollection instance, add your input messages to it and then call Execute() with it. Not too bad, but inconvenient if you only have one or two messages (which is most of the time).

I thought about several possible syntaxes to simplify this, but in the end decided to do the simplest fix: I added a new overload to SendPipelineWrapper.Execute() that has a params array of IBaseMessage instances. So you can now do this:

IBaseMessage output = pipeline.Execute(message1, message2);

Simple, but effective!



Comments are closed.

Syndicate

About

Tomas Restrepo is a software developer located in Colombia, South America. His interests include .NET, Connected Systems, PowerShell and lately dynamic programming languages. More...

tomasrestrepo @ twitter My Flickr photostream My saved links on delicious My Technorati Profile

email: tomas@winterdom.com
msn: tomasr@passport.com

View my profile on LinkedIn

MVP logo

Ads


Links

Categories

Statistics

Total Posts: 1024
This Year: 94
This Month: 1
This Week: 2
Comments: 795

Blogroll

Archive

Other

Copyright © 2002-2008, Tomas Restrepo.

Powered by: newtelligence dasBlog 2.1.8139.823

Sign In