There are several situations where you would want to use the Watch a Folder for New [Format] Files input to read data files from your file system into GeoEvent. Typically, I see this input used when GeoEvent doesn't supply an Input Connector for the specified situation (e.g. an FTP transport). To get around this, people will write a script that will gather the external data, write it to a file, then expect GeoEvent to import that data. However, some report issues in this approach as files will get skipped, or data corrupted when it is read into GeoEvent. This blog presents a way around that issue:
Set your GeoEvent Watch a Folder for New [] Files input up to read files with an extension of .csv (or any extension that meets your needs, so long as it is different from the extension used below).
Depending on the data contained in your CSV file, you might need to change some of the Advanced properites on the input:
Starting to read file "TestDataLookup.csv"...
Failed to translate an event. The GeoEvent Definition "Radio_Name" was not found.
Failed to translate an event. The GeoEvent Definition "AK487" was not found.
Finished reading all of the lines "2" in the file "TestDataLookup.csv" in 3 ms.
When you write the data (from your script, application, or other means):
Since changing a file name on the OS is atomic, this process guarantees that GeoEvent won't try to start reading the data until it has been fully committed to disk. Please note that #3 only works if you use a RENAME or MOVE (updating the file path/name). You cannot use a COPY for #3 because this just ends up copying the bytes again and you will run into the same original problem.
Attached to this post is a sample script that shows how to do this in python.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.