Fat32 File Systems and the EasyHL7 Router Products

Previous  Top 

All EasyHL7 Routers are Created Equal

 

All of the EasyHL7 TCP/IP Router (HL7 sending) products are configured basically the same way in that they all share the same major properties which are:

 

1.A windows path to a file system folder which will contain data files with HL7 messages which you wish to send to an HL7 trading partner via TCP/IP.
2.A set of connection information (IP Address, Port Number, Timeout, etc) which tells the router how to connect to the HL7 trading partner.

 

All EasyHL7 Routers have the same triggering mechanism

 

Functionally all of these products also work in the same basic way when it comes to handling files. When working the router will periodically check the windows folder (see item 1 above) for the existence of HL7 data files. If HL7 data files are detected the router then springs into action to try and send the HL7 messages out.

 

Determining the Sending Order

 

Before sending the HL7 messages it is very important for the router to determine in which order to send the HL7 messages to the trading partner. To do this the router will build a list of all of the pertinent HL7 data files in memory and will sort that list in ascending order by the MS Windows Last Modified Date/Time property of the file and as a secondary sort by the physical file name. If any file contains multiple messages, the router will assume that the messages in that file are to be sent in the order in which they appear within that particular file.

 

SCENARIO 1.

 

File Name

File Date/Time

# of Messages in the File

FileA.hl7

2009-03-01 08:30:01 AM

1

FileB.hl7

2009-03-01 08:30:02 AM

2

FileC.hl7

2009-03-01 08:30:03 AM

1

 

In Scenario 1, the HL7 message contained in FileA.hl7 would be sent, followed by the 2 messages in FileB.hl7, followed by the single message in FileC.hl7. The router will NOT skip messages to be sent. If it is unable to connect to the trading partner, it will wait and try again. If it is able to connect to the trading partner it will send each message until the specific sending parameters configured are met.

 

SCENARIO 2.

 

File Name

File Date/Time

# of Messages in the File

FileB.hl7

2009-03-01 08:30:01 AM

2

FileC.hl7

2009-03-01 08:30:02 AM

1

FileA.hl7

2009-03-01 08:30:03 AM

1

 

In Scenario 2, the 2 HL7 messages contained in FileB.hl7 would be sent, followed by the  message in FileC.hl7, followed by the single message in FileA.hl7.

 

 

 

Windows File Systems behave differently!

 

But what if all 3 of the files have the same file date/time stamp in Windows? Each files date/time stamp is actually made up of 8 parts (Century, Year, Month, Day, Hour, Minute, Second, Millisecond). So multiple files which have a truly IDENTICAL date/time stamp is actually very unlikely for files that are actually being created on the same computer. The EasyHL7 Routers actually look at the extended attributes of the HL7 data files to and also factor in the part of the date/time stamp which is not visible in MS Windows Explorer which is the Milliseconds property.

 

SCENARIO 3a (NTFS File System).

 

File Name

File Date/Time

Milliseconds

# of Messages in the File

FileB.hl7

2009-03-01 08:30:01 AM

10

2

FileC.hl7

2009-03-01 08:30:01 AM

43

1

FileA.hl7

2009-03-01 08:30:01 AM

52

1

 

In Scenario 3a, because the routers actually use the entire date/time stamp when the files are sorted internally they would come out in the order shown above so the 2 HL7 messages contained in FileB.hl7 would be sent, followed by the  message in FileC.hl7, followed by the single message in FileA.hl7. However, this is ONLY TRUE IF THE FOLDER IS ON AN NTFS FILE SYSTEM!

 

SCENARIO 3b (FAT32 file System).

 

The problem arises with the MS Windows Fat32 File System. The MS Windows API will always return 0 in the milliseconds property of the timestamp for files in a Fat32 system.

 

File Name

File Date/Time

MS Actual

MS Fat32

# of Messages in the File

FileA.hl7

2009-03-01 08:30:01 AM

52

00

1

FileB.hl7

2009-03-01 08:30:01 AM

10

00

2

FileC.hl7

2009-03-01 08:30:01 AM

43

00

1

 

In Scenario 3b, despite the fact that in reality the files were actually created in the order FileB, FileC, FileA, the FAT32 file system always returns 0 in the Milliseconds property and since all 3 of the files were created within the same second the router would determine that the files needed to be sent out in the order displayed. This happens because the router uses the File Name as the secondary sort. Please note that this is NOT A BUG it is a BEHAVIOR of the MS Windows Operating system and Fat32 File System and as such Microsoft has no plans to fix it and of course there's nothing we can do.

 

How do I keep this from impacting me?

 

The best way to make sure that this behavior doesn't affect you is to make sure that all folders accessed by the EasyHL7 Router software are on an NTFS file system.

 

If you can't guarantee this, then the second tier of protection would be to insure that your application which is producing the HL7 data files uses a file naming convention that will insure that files are in the correct order NO MATTER HOW they are sorted. For instance some derivation of a naming convention like <DateTimeStamp>.<SequentialNumber>.hl7 Ex: 20090312083022.001.hl7, 20090312083022.002.hl7, 20090312083022.003.hl7, 20090312083023.001.hl7. Using a naming convention like this would insure that even if the files were created on a Fat32 system when the EasyHL7 router sorted the files the secondary sort (file name) would insure that all messages created within the same second would be sent in the proper order.

 

 

 

 

 

 

 


EasyHL7 Home Page