biztalk zero byte files

FILE-Z Adapter: file adapter to consume and process empty (zero bytes) files

Published on : Dec 3, 2021

Category : BizTalk Server

Sandro

Author

Unfortunately, some good BizTalk Server resources have disappeared over these years, and they are no longer available. A lot of these resources are custom adapters. So today, I’m happy to bring back alive an “old” new adapter that, as far I remember, was initially published by 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.

I never faced this requirement on my projects, but I understand the need, and several community members have already reached out to me regarding this requirement.

As Nino mentioned in his blog post, sometimes there is a need to integrate systems that send empty files (zero bytes). He found that need in many big infrastructures that use this method to warn the destination system that the transmission is ended. For example, during AS400 file transmission, where these files are usually called tap files. I know other samples where a system places a file in a shared folder every day. Regardless of this file is empty or contains data, it has to be processed.

The default BizTalk Server FILE Adapter file cannot process these types of files. It grabs and deletes the file from the source folder, but it doesn’t trigger any associated process. 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.

To resolve this “issue” that, in fact, is a behaviour by design according to Microsoft I decided to take the approach explained by Nino in his blog post and make use of:

  • DotNet File Adapter sample source code that was available on previous versions of the BizTalk Server SDK
  • An old version of the Nino Crudele’s source code

And recreate and redesign that adapter with some improvements and rebrand it as: BizTalk Server FILE-Z Adapter. This adapter can be used as a Receive Adapter or as a Send Adapter.

biztalk zero byte files

Why the name File-Z?

Well, first of all, because it meant to mean File-Zero, but in reality, because I was a huge fan of Dragon Ball Z 🙂

How to install it?

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

  • Access the FILE-Z Adapter GitHub page and download the content of the folder executables.
  • Place the folder BizTalkFileZAdapter 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-Z
    • In the Adapter combo box, select the adapter from the drop-down that you want to add.
      • FILE-Z
    • In the Description box, type a description for the adapter (this is optional).
      • File adapter that can process empty files (zero bytes).
  • Click OK to complete the process of adding the adapter.

Download

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

You can download the BizTalk Server FILE-Z Adapter from GitHub here: FILE-Z Adapter