FILE-RADITZ Adapter: File adapter that ignores empty (zero bytes) files

Recently I developed a custom file adapter called FILE-Z adapter that I blogged on the BizTalk360 blog. This is an adapter created from the original idea of my dear friend Nino Crudele. It is a custom File adapter capable of reading empty files.

You can see his original blog post here: BizTalk and zero byte file. And you can download the FILE-Z adapter here: FILE-Z adapter GitHub page.

But while I was searching about this adapter, I found an interesting blog post from Yan (Pamela) Yang where she described a different scenario. Some systems can create empty files without locking them. Then, they grab the files again and write some data to them. However, this behavior may cause problems with the default BizTalk Server FILE adapter. For example, the adapter may grab the file AFTER the system creates the empty file, but BEFORE the system attempts to write to it, causing integration issues. Or, in other cases, we may not want to pick up that empty files.

You may also know that the native FILE adapter released with BizTalk grabs and deletes all zero-byte (empty) files without triggering any associated processes. Instead, it logs a warning or error saying that:

The FILE receive adapter deleted the empty file “dir:<folder>\<file-name>” without performing any processing.

This behavior, according to Microsoft, is by design. Though you can argue that it is not consistent how different adapters treat empty files, e.g., FTP adapter can transfer empty files with no problem.

The File-RADITZ adapter is, kind of, the arch-enemy of the File-Z Adapter. This adapter doesn’t pick up or process empty (zero-byte) files. Instead, it leaves the empty files in the original folder.

I decided to create or recreate this adapter based on Yan Yang scenario just for fun and for mentoring how you can create your custom File adapter by making use of:

  • DotNet File Adapter sample source code that was available on previous versions of the BizTalk Server SDK

This adapter can be used as a Receive Adapter or as a Send Adapter.

Why the name File-RADITZ?

Well, I named the other adapter FILE-Z because it meant to mean File-Zero, but in reality, because I was a massive fan of Dragon Ball Z :). As I mentioned before, this adapter is, kind of, the arch-enemy of the File-Z Adapter. So, making the idea for a better name, I named it based on a memorable Dragon Ball villain: Raditz, that was one of the first enemy encounters in Dragon Ball Z.

How to install it?

If you want to install the BizTalk Server FILE-RADITZ Adapter, you need to:

  • Access the FILE-RADITZ Adapter GitHub page and download the content of the folder executables.
  • Place the folder BizTalkFileRADITZAdapter on any location on your BizTalk Server box. I will recommend to put it in:
    • C:\Program Files (x86)\
    • Note: if you put in any other path you need to modify the StaticAdapterManagement.reg file
  • Access the folder and double-click on the StaticAdapterManagement.reg file

This will register the adapter to run under 32-bit host instances. To make it available also for 64-bits, you need to:

  • Click Start
  • Type %windir%\SysWoW64\cmd.exe in the search box and press enter
  • Run the same adapter registry (.reg) file from this command prompt

Now you just need to add this adapter to the BizTalk Server Administration Console:

  • Open BizTalk Administration Console by pressing the Windows key to switch to the Start menu, type BizTalk Server Administration or BizTalk, click the BizTalk Server Administration option from the Search window.
  • In the console left tree, expand BizTalk Server Administration > BizTalk Group > Platform Settings and then Adapters.
  • In the Adapter Properties
    • In the Name box, type a descriptive name for this adapter.
      • FILE-RADITZ
    • In the Adapter combo box, select the adapter from the drop-down that you want to add.
      • FILE-RADITZ
    • In the Description box, type a description for the adapter (this is optional).
      • BizTalk Server File Adapter that is able to process all files except empty (zero byte) files.
  • Click OK to complete the process of adding the adapter.

Where can you use it?

This version available on GitHub is currently compiled on .NET 4.7.2 and optimized for BizTalk Server 2020. Nevertheless, you can take this code and compile it in other versions of .NET and BizTalk Server. It will be 100% compatible.

Download

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

You can download the BizTalk Server FILE-RADITZ Adapter 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