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();

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()
.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!

Technorati tags: ,


Tomas Restrepo

Software developer located in Colombia. Sr. PFE at Microsoft.