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.