BizTalk Pipeline Components Extensions Utility Pack: Local Archive Pipeline Component

BizTalk Pipeline Components Extensions Utility Pack community project for BizTalk Server 2016, once again, got a new update and it now has a new component that you can use in your custom BizTalk Server pipelines: Local Archive Pipeline Component.

Local Archive Pipeline Component

BizTalk Server Local Archive pipeline component it’s a pipeline component that can be used for archiving incoming/outgoing message from any adapters. It will provide the following capabilities:

  • 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 in 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.
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) with several custom pipeline components that can be used in received and sent pipelines, which will provide an extension of BizTalk out-of-the-box pipeline capabilities.

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

BizTalk Pipeline Components Extensions Utility Pack: Local Archive Pipeline Component

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.

Where to download it?

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

BizTalk Pipeline Components Extensions Utility Pack
GitHub

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 *

turbo360

Back to Top