This post summarises what happens when some BizTalk Adapters picks up a zero byte file. I am using BizTalk Server 2013 R2 with CU2 for these tests.
First let’s make it clear what zero byte file I used for my testing. I created my test file by opening notepad and saving as an XML file without adding anything to it. If you open the file in a binary editor it looks like this.
Second let’s set up a receive location that uses a file adapter as shown below.
If we drop zero-byte file above into the pick up folder the following warning is recorded in the event log.
Log Name: Application
Source: BizTalk Server
Date: 17/02/2016 9:39:43 p.m.
Event ID: 7182
Task Category: BizTalk Server
The FILE receive adapter deleted the empty file “D:\brimble1\Test\zero.xml” without performing any processing.
The File receive adapter deletes zero byte files by design. Many people have wanted to process zero byte files . Why would you want to process a zero byte file? In most cases this is an annoyance because a zero byte would fail in any pipeline that contains a XML Disassembler. In many cases I have had applications that randomly create zero byte files and the design of the BizTalk Server has been a god send because I do not have to implement any special pipeline component to handle this situation.
What does the BizTalk Server FTP adapter do if it picks up a zero byte file? Let’s set up a receive location with a FTP adapter and pick up the same zero byte file as shown below;
This time the file suspends in BizTalk Server the group hub because I had no subscription to this receive port. This is OK because it shows that the zero byte file has got into the message box. This is annoying if you are not using a pass through pipeline because invariably the zero byte file will error in the pipeline.
Now what happens if we subscribe to this receive port with a send port that uses file adapter and a pass through pipeline? The zero byte file gets written to the destination folder.
How do other adapters behave with zero byte files? The SFTP adapter cannot send zero-byte file . CU1 for BizTalk Server 2013R2 contains a fix for this but I have not tried the SFTP receive adapter with zero bytes files. This author has struggled with a HTTP receive adapter that would happily deliver zero byte files.
In summary while the receive file adapter deletes empty files the receive FTP adapter does not. If you want to pick up zero-byte files then I think you can use the FTP adapter instead of the FILE adapter. If you want to do this this then you will have to use a custom pipeline or an orchestration for further processing.