I'm putting together a Windows service for a client that will run scheduled batch jobs (sending out emails, archiving data, etc..) and was wondering what a typical solution might be for this? I wrote a couple services based on the CSLA BatchQueue a long while back, and was considering using it again since it's fairly lightweight, even though it was dropped from the CSLA framework years ago.
I noticed Rocky mentioned PowerShell or WF as newer possibilities for this scenario. Has anyone implemented something like that? The main requirements are that the batch jobs need to execute C# code and run on a Windows server. A full-fledged WF host might be overkill, but if it's not too painful to set up/configure I'll go that route.
Why would you write a Windows Service for a scheduled task/ batch job?
Windows /Vista/7/8/Server2008/Server2012) has a building Task Scheduler:
And if you need a managed solution with separate database for logging and configuration look at Autorun:
The last time I was working on a solution for scheduling tasks was pre-Windows 7, hence the my ignorance about the built-in Task Scheduler.
Autorun looks like the right way to go and will save a lot of time with it's built in Windows app. Thanks for the great tip!
I had pretty good luck a couple of years ago, using an open source Enterprise Job Scheduler called Quartz.Net (a port to .Net of a Java tool).
We created a central web service to which jobs were submitted. Remote websites would then "phone home" to the service to see if any jobs had been submitted (submitted jobs were specific as to the server they were to run on). If any jobs were scheduled to be run for the server phoning in, those jobs were downloaded and run. A "job" can be anything you define in code.
Might be overkill for your needs, but it worked, and was pretty easy to get up and running.
Thanks for the idea, GaryG. That sounds like a cool way to load balance jobs across multiple servers. For our purposes, it's probably overkill at least for now.
Copyright (c) Marimer LLC