I need to write an application that will monitor a specific folder for new files created by a 3rd party software, then copy them to my repository and send them, one by one, to a web service. Once the file sent, it will be deleted from the repo.
I will obviously use the FileSystemWatcher for file monitoring and copy them to my repo.
Then i will Enqueue copied file names to the Queue.
What should i do from here?
How do i manage this Queue and Dequeue when file was sent?
Another question is how to make this thread-safe, since the Queue is being accessed from different theads (FileSystemWatcher)?
What is the best and safest way to implement this?
Thanks for you answers,
SkyFox
In the beginning:
In the file watcher event (file created):
the ‘worker’: