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) with several custom pipeline components that can be used in receive and sent pipelines. Those pipeline components provide extensions of BizTalk’s out-of-the-box pipeline capabilities.

Message Archive Pipeline Component

The Message Archive Pipeline Component is a pipeline component that can be used to arch incoming/outgoing messages from any adapters into a local or shared folder. It is very identical 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, network folder.
  • It can be used from any adapter:
    • If the adapter provides the ReceivedFileName property promoted like the File adapter or FTP adapter the component will take this value into consideration and save the message with the same name;
    • Otherwise, it will use the MessageID, saving the file with the MessageID has its name without 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 that they do their logic either as a custom stream implementation or by reacting to the events available to you through the Microsoft.BizTalk.Streaming.dll stream classes. Without ever keeping anything except 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.

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

Property NameDescriptionSample Values
OverwriteExistingFileDefine if the archive file is to be overwritten if already existstrue/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%
ArchiveFilenameMacroFile name template. If empty the source file name or MessageId will be used. You can use macros to dynamically define the filename.%ReceivePort%_%MessageID%.xml
AdditionalMacroIfExistsIf 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._%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%Name of the file from which the File adapter read the message. The file name includes the extension and excludes the file path, for example, Sample.xml. When substituting this property, the File adapter extracts the file name from the absolute file path stored in the FILE.ReceivedFileName context property. If the context property does not have a value the MessageId will be used.
%FileNameWithoutExtension%Same of the %FileName% but without extension.
%FileNameExtension%Same of 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 on the Pipeline Components folder that in 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, to use the pipeline component, I recommend 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 Message Archive Pipeline Component from GitHub here:

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 *

turbo360

Back to Top