I would like to have the same service on multiple servers watching a single directory (on a shared server or SAN). When a file appears in that directory I want one, and only one of those services to pick up that file and process its contents.
I attempted to program this by moving the file out of the shared directory before processing it. I am fine with simply handling the exception on whichever server fails to move the file. The problem is that conflicts occur and cause the file not to be processed by either server.
It is likely that files will arrive in batches, not one by one. Does anyone know an approach to this that will work in a guaranteed way?
Try having one 'master' service with a FSW. The master service processes all FSW events and commands 'slave' services on remote machines to handle a certain file. Easy load balancing, no multiple FSW issues, no database needed. You could easily accomplish this with WCF.