Stream of files


#1

Hello,

Let’s say n devices independently generate data files, each it its own directory.
I would like to write a C# (or F#) program, which would monitor the n directories,
and as soon as a file is created, scan it, store its data in a MySQL database in a semaphore-like
fashion to prevent concurrent access to the database (unless MySQL handles concurrency
well enough).

I’ve had a first stab at the program using six DotNet FileSystemMonitor instances to
monitor the directories for files. However, I wonder if there isn’t a better way to
do this using, say, a functional-like file stream or stack metaphore.

Any help would be much appreciated.

Many thanks.

Best regards,

pr1


#2

Sounds like a good fit for using Observables. Maybe the FsNotify package could be useful.


#3

Hi mbuhot,

Very nice.

Unfortunately, it doesn’t build.

I found a Go version with the same name that builds.