Should I ask a question I know the answer to?
I've had to solve an irritatingly complex problem - I think this solution would be of use to other developers.
In brief, I've got an .Net4/MVC3 web app which supports the concept of scheduled jobs. There's a windows service which executes the jobs.
Every time we publish (using deployment), the windows service detects the changes to the website DLLs, sends a graceful termination signal to all running jobs and waits for them to terminate. In parallel, it creates a new AppDomain and loads the [new] DLLs from the website then scans for any classes which implement
IJob, reads any relevant attributes and executes the code in line with the defined schedule (technically, each class implements a
bool ShouldExecute() which can be polled and allows for complex logic.
Benefits include: No additional steps during deployment, shared container/IoC config, very robust, etc...
So... Should I post this as a Q/A on SO?
I'm not sure how I should tag this Q so any improvements appreciated :)