Share via


In a pipeline component, some streams are not seekable: Improvements to the Archiver

A while back, I presented my Archiver Component . It archives messages as they enter a receive pipeline or right before they leave a send pipeline. It turns out that "DT" found a problem with this component (thank you for reporting this). I have updated the original entry and fixed the code.

The error in the code I originally provided was to use BodyPart.GetOriginalDataStream() even if I had the right comment above it!:

   // Get a *copy* of the original input stream
   originalStrm = bodyPart.GetOriginalDataStream();

I should have used BodyPart.Data which in the case of custom pipeline components makes a copy of the inbound message:

   // Get a *copy* of the original input stream
originalStrm = bodyPart.Data;

At this point, rewinding the stream into the finally block is not needed anymore. The updated source code can be found here .

Comments

  • Anonymous
    September 18, 2004
    it's great helpful! thanks.
  • Anonymous
    September 29, 2004
    This works perfectly fine in the receive and send pipelines when dealing with flat file data on the receive and xml data on the send.
    However, I am having trouble archiving when flat file data is on the send pipeline.. giving a forward read only error, can't seem to get any data . Any suggestions?

    best regards,
    aman
  • Anonymous
    September 29, 2004
    Aman: Without more information about that "read only error", I won't be able to help you. One thing to verify: we actually write a file to the file system, so does the user which runs the pipeline (the host running it) actually has the rights to write a file on the path you specified?

    Attach a debugger to BTSNTSVC.EXE, break on first chance exceptions and give me the call stack when the error happens and I'll be able to help you further.
  • Anonymous
    October 03, 2004
    The comment has been removed
  • Anonymous
    April 08, 2006
    The comment has been removed
  • Anonymous
    May 27, 2008
    PingBack from http://benrunchey.wordpress.com/2008/05/27/what-i-learned-yesterday-12/