Message Archive Pipeline Component

  • Sandro Pereira
  • Mar 28, 2022
  • 5 min read

Indeed, another message archive pipeline component on my BizTalk Pipeline Components Extensions Utility Pack project is available on GitHub!

This time, I decided to create a brand new component called the Message Archive Pipeline Component.

For those who aren’t familiar with it, the BizTalk Pipeline Components Extensions Utility Pack project is a set of custom pipeline components (libraries) that can be used in receive and send pipelines. Those pipeline components extend BizTalk’s out-of-the-box pipeline capabilities.

BizTalk Pipeline Components Extensions Utility Pack

📝 One-Minute Brief

A lightweight BizTalk pipeline component that automatically archives incoming messages before processing, allowing you to keep copies for auditing, troubleshooting, or long‑term storage. It extends BizTalk’s native pipeline capabilities and makes it easy to save messages without modifying orchestrations or receive locations.

Message Archive Pipeline Component

The Message Archive Pipeline Component is a pipeline component that can be used to archive incoming/outgoing messages from any adapters into a local or shared folder. It is very similar and provides the same capabilities as the already existing BizTalk Server Local Archive pipeline component:

  • It can be used in any stage of a receive pipeline or send pipeline.
  • It can be used in multiple stages of a receive pipeline or send pipeline.
  • It provides an option for you to specify the location path for where you want to save the message: local folder, shared folder, or network folder.
  • It can be used with any adapter:
    • If the adapter provides the ReceivedFileName property, promoted as in the File or FTP adapter, the component will use this value and save the message with the same name.
    • Otherwise, it will use the MessageID to save the file, naming it after the MessageID without an extension.

So what are the differences between them?

The significant differences between these two components are that the Message Archive Pipeline Component allows you to:

  • Set the filename using macros like %datetime%, %ReceivePort%, %Day%, etc.
    • For example, %ReceivePort%_%MessageID%.xml
  • Set the archive file path once again using macros:
    • for example C:\BizTalkPorts\Archive\ARCHIVE\%Year%%Month%%Day%
  • If you don’t want to overwrite existing files, you can specify an additional Macro to distinguish them.
    • For example _%time%
  • You can set up this component for high performance using forward-only streaming best practices.
    • In short, this means developing your pipeline components so they either implement their logic as a custom stream or react to the events available to you through the Microsoft.BizTalk.Streaming.dll stream classes. Without ever keeping anything other than the small stream buffer in Memory, and without ever seeking the original stream. This is best practice from the perspective of resource utilization, both memory and processor cycles.
Message Archive

This is the list of properties that you can set up on the archive pipeline component:

Property NameDescriptionSample Values
OverwriteExistingFileFile name template. If empty, the source file name or MessageId will be used. You can use macros to dynamically define the filename.true/false
ArchivingEnabledDefine if the archive capabilities are enabled or disabledtrue/false
ArchiveFilePathArchive folder path. You can use macros to dynamically define the path.C:\Archive\%Year%%Month%%Day%
ArchiveFilenameMacroIf a file already exists and OverwriteExistingFile is set to false, a suffix can be added. If empty, the MessageId will be used. You can use macros to dynamically define this suffix.%ReceivePort%_%MessageID%.xml
AdditionalMacroIfExistsSetting to apply high performance to the archive_%time%
OptimizeForPerformanceSetting to apply high performance on the archivetrue/false

Available macros

This is the list of macros that you use on the archive pipeline component:

Property NameDescription
%datetime%Coordinated Universal Time (UTC) date time in the format YYYY-MM-DDThhmmss (for example, 1997-07-12T103508).
%MessageID%Globally unique identifier (GUID) of the message in BizTalk Server. The value comes directly from the message context property BTS.MessageID.
%FileName%Same as the %FileName%, but without extension.
%FileNameWithoutExtension%Same as the %FileName% but in this case only the extension with a dot: .xml
%FileNameExtension%Same as the %FileName%, but in this case only the extension with a dot: .xml
%Day%UTC Current day.
%Month%UTC Current month.
%Year%UTC Current year.
%time%UTC time in the format hhmmss.
%ReceivePort%Receive port name.
%ReceiveLocation%Receive location name.
%SendPort%Send port name.
%InboundTransportType%Inbound Transport Type.
%InterchangeID%InterchangeID.

How to install it

As always, you just need to add these DLLs to the Pipeline Components folder that in the BizTalk Server 2020 is by default:

  • C:\Program Files (x86)\Microsoft BizTalk Server\Pipeline Components

In this particular component, we need to have this  DLL:

  • BizTalk.PipelineComponents.MessageArchive.dll

How to use it

Like all previous ones, to use the pipeline component, I recommend that you to create a generic or several generic pipelines that can be reused by all your applications and add the Message Archive Pipeline Component in the stage you desire. The component can be used in a stage of the receive and send pipelines.

Download

THIS COMPONENT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

You can download the Message Archive Pipeline Component from GitHub here:

Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son. 

Thanks for Buying me a coffe
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top