I have a question about which approach I should take. I am getting confused between a window service and a console application which will run by the task scheduler. I wasn’t sure if I am allowed to ask a design question on this website. I needed advice.
- I am creating an application which will watch multiple paths for new files. The paths will be obtained from database. This is an existing features so paths will always be on the database.
- If a file is found, I need to check if the parent file has been loaded. This will need to be done by check a table on the database. If the parent file has been loaded then the new file will load into the database else delay the file until parent file is loaded.
I started with a window service but realized that I need to refresh my paths and watchers if a new path is added or an existing path is changed on the database. This will happen a lot. I didn’t want to hit the database constantly. So I added a timer and removed file watcher so it gets hit every 2 minutes. First I get the paths then looks at the paths for new files, the load them if parent files are loaded else delay them.
The main issue is the starting event. My file watcher paths are on the database and can constantly change. Other examples I seen on the internet is that the path are always determined before the window service starts.
Since I have added a 2 minutes timer, this defeats the purpose of a window service which supposed to be 24/7. I can just make an console application and run it every 2 minutes on the task scheduler on the server. Will there be any advantages to keeping it as a window service?
I am open to suggestion if there is another approach.