Click here to Skip to main content
15,891,431 members

Comments by Mattintosh (Top 1 by date)

Mattintosh 25-Jun-13 16:27pm View    
Spot on. I have written stuff that works exactly this way in the past, and I highly recommend it for unattended batch processing, with a couple of things to be aware of first.

1) Scheduled Tasks (in more recent versions of Windows, it's called Task Manager, and it's under Administrative Tools) will not run more often than every 5 minutes. You set it up to trigger the actions daily at a set time, repeating every 5 minutes thereafter. From what I can tell, you cannot run your task trigger more often than this. If you need to run it with more than a 5 minute granularity, you'll have to use a Windows Service and a threading timer.

2) Building a new command line app for every task you want to trigger is a difficult-to-maintain mess. So you're going to have some overhead with a general-purpose task engine. The ones I've written are specific enough to require an input, archive, and error directory path (or hostname, paths, and credentials for FTP) for each sub-task. The engine checks the database to see which sub-tasks need to run right now, and it kicks them off. The sub-tasks themselves are smart enough to go get their files from the input location and process them, then move them to the archive or error locations (pass/fail style, and we keep a complete history).

So there's a table in the database that tells it when to run, where to get data, where to put data, and what classname to instantiate to process the data. There's a command-line app that gets that config for the currently needed processes, instantiates each active process' class, and runs it. And there's a timer that kicks off the command-line app every 5 minutes.

It works well and it's dirt simple. Let the OS handle the timing stuff. Don't invent your own if you don't have to.