My solution was pretty simple.
1. Which ever file arrives first, write it to a file with an extension of msg or pdf.
2. Which ever file arrives second, pull the contents of its mate out of the file, combine them into a single message and then write them to a different file location with a .hl7 extension
3. Delete the original message from the file system.
4. Finally, I have a inbound fileset local that polls for the .hl7 message, slurps it up and sends it on its way.
In the testing tool, this works perfectly, however, these two messages arrive almost simultaneously and the first file isn’t finished writing to the file system before the second goes looking for it, causing the second file to be written to the file system as well.
I have tried putting a sleep in the tcl just before it goes looking for the first file, but it seems that because the messages arrive milliseconds apart, the both sleep that 5 seconds concurrently and the same issue happens.
Any suggestions on how to delay the second message until the first is written?