Siva Ram asks in a comment on a previous post:

"How to Archive/(copy to another location) the Source file as it is , Before the biztalk picks up the file?"

I think what he's really asking is how he could archive an exact copy of the original incoming message (possibly for regulatory compliance, auditing, or simply to provide easier tracing of problems). This is a common question, and the truth is there are several ways to approach this in BizTalk server.

Here are some options:

Double Hop: A fairly simple option is to do a double hop when processing the incoming message. Instead of parsing and processing the message right away, receive it through a pass-thru pipeline (so the message isn't changed) and route it using filters to two FILE send ports. One of them points to your archive location, while the other points to a temporary folder, from which you pick up the message again using the FILE adapter to do the real processing.

This is a rather simple way to implement this, but it can be pretty inefficient. It's particularly bad if messages are large because it involves several round-trips to the message box.

Use BizTalk Tracking: For some scenarios, it is enough to just enable message tracking in your receive location, making sure to select the option to track the message before it goes through the pipeline. Messages will then be saved in your DTA database, from which you can query and retrieve them using HAT or WMI.

Use a pipeline component: Using a custom decoding pipeline component that writes the message out as it is read by the receive pipeline is another good option. It is a bit more complex to implement, but it can be very efficient if implemented properly. Jeff Lynch has a simple Archive component you can use to start, though be aware his version will not work if you're dealing with adapters that use non-seekable streams to hold message content. My own old Tracer pipeline component might also be a place to start with this.

I hope this gives you an idea of how to start fulfilling your requirement!

Technorati tags:

Tomas Restrepo

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