BizTalk Pipeline Components Extensions Utility Pack: Local Archive Pipeline Component

  • Sandro Pereira
  • Dec 12, 2019
  • 3 min read

The BizTalk Pipeline Components Extensions Utility Pack, a community project for BizTalk Server 2016, has received another update. This release introduces a new component that you can use in custom BizTalk Server pipelines: the Local Archive Pipeline Component.

📝 One-Minute Brief

Introduces the Local Archive Pipeline Component for BizTalk Server, a custom pipeline component that allows you to archive incoming and outgoing messages from any adapter to a local or shared file system location.

Local Archive Pipeline Component

The Local Archive Pipeline Component allows you to archive incoming and outgoing messages from any BizTalk adapter in a simple and flexible way.

This component provides the following capabilities:

  • You can use it in any stage of a receive pipeline or a send pipeline.
  • You can place it in multiple stages within the same receive or send pipeline.
  • You can configure the destination path where BizTalk saves archived messages, including:
    • local folders
    • shared folders
    • network locations

The component works with any adapter:

  • When the adapter promotes the ReceivedFileName property (for example, the File or FTP adapter), the component uses that value and saves the message with the original filename.
  • When the adapter does not provide a filename, the component saves the message using the MessageID as the filename, without an extension.
public Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext pc, Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)
{
    // 
    // TODO: implement component logic
    // 
    // this way, it's a passthrough pipeline component
 
    if (this.PerformBackup)
    {
        try
        {
            //Get Message Id
            Guid msgId = inmsg.MessageID;
 
            //Get Filename by FileAdapter NS
            string fileName = inmsg.Context.Read("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties").ToString();
            if (string.IsNullOrEmpty(fileName))
            {
                fileName = inmsg.Context.Read("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/ftp-properties").ToString();
                if (string.IsNullOrEmpty(fileName))
                {
                    fileName = msgId.ToString();
                }
            }
 
            if (!new DirectoryInfo(this.Folder).Exists)
            {
                try
                {
                    Directory.CreateDirectory(this.Folder);
                }
                catch
                {
                    throw;
                }
            }
 
            SaveStreamToFile(inmsg.BodyPart.Data, fileName, true);
 
            inmsg.BodyPart.Data.Position = 0;
        }
        catch
        {
            throw;
        }
    }
 
    return inmsg;
}

What is BizTalk Pipeline Components Extensions Utility Pack?

BizTalk Pipeline Components Extensions Utility Pack is a set of custom pipeline components (libraries) that can be used in received and sent pipelines, extending BizTalk’s out-of-the-box pipeline capabilities.

BizTalk Pipeline Components Extensions Utility Pack: Zip Pipeline Component

The project is available on the BizTalk Server Open Source Community repository on GitHub (https://github.com/BizTalkCommunity), and everyone can contribute new pipeline components to extend or improve existing BizTalk Server capabilities.

At the moment, it is only available for BizTalk Server 2016, but it will soon be compiled and available for previous versions of the product.

Download

You can download BizTalk Pipeline Components Extensions Utility Pack from GitHub:

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.

4 thoughts on “BizTalk Pipeline Components Extensions Utility Pack: Local Archive Pipeline Component”

  1. Thank you for this.
    I can see code in GitHub for BTS2006-2009, BTS2010 and BTS2016.

    Can I use the BTS2016 code for BTS2020 ?

  2. This is what I need! But:

    When trying to upload the component to toolbox I get this error: “You have selected an invalid pipeline component assembly. Please check security settings for the assembly if you are loading it from an UNC path.”

    I have checked all dependencies and added the dll to “…\Pipeline Components”-folder.

    What am I missing?

  3. HI Sandro
    Thank you for this good direction.
    I am gonna to see and have .Context.read(“ReceivePortName”,”http://schemas.microsoft.com/BizTalk/2003/system-properties”);
    in the context window of the suspended message, could you please provide the steps to add ‘ReceivePortName’ to the context of messages details in Biztalk 2020?

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