Safe File Writing/LockingΒΆ
The Problem
- ERP writes an in-house file; bots starts to read this before the file is completely written.
 - Bots writes file over FTP, but file is read before Bots finishes writing.
 
The Solution
Tmp-part file name: bots writes a filename, than renames the file.
Example 1. In channel: filename ismyfilename_*.edi.tmp, tmp-part is.tmpBots writes:myfilename_12345.edi.tmpBots renames:myfilename_12345.ediSystem lock: use system file locks for reading or writing edi files (windows, *nix).
Lock-file: Directory locking: if lock-file exists in directory, directory is locked for reading/writing. Both reader and writer should check for this.