A while back I blogged a few posts about creating custom timer jobs (here, here, here and here) and last week I pointed to a new MSDN Visual How To that shows how to do the same thing. There is also now a much more in-depth article I wrote that is now on MSDN that contains a lot of additional information about creating, deploying and debugging custom timer jobs.
There are a few cool extra nuggets in this article that I want to point out.
- The scenario I walk you through is not terribly “production” common, but rather something people like me need when teaching or presenting on SharePoint. We all know that many things in SharePoint requires application pool recycles. The part that's a pain is the warm-up time for the application pool (not a SharePoint issue, it's just an aspect of ASP.NET's JIT compilation of the pages). Microsoft first came out with something called the warmup scripts that are great in demos, but they are command line driven & you still have to manually recycle the app pool from the IIS manager or . My pal Spence has a killer utility that sits in the system tray which makes it very easy to recycle the app pool & warm up provided URLs: Application Pool Manager. What the timer job does is enable you to configure scheduled requests to specific site collections as shown in the article. It doesn't replace Spence's utility… I still use that. But it keeps your SharePoint site from “falling asleep.” So, you can use this for your own SharePoint sites!
- The job needed some way to store configuration information. There are plenty of ways to do this, but I elected to use the hierarchical object store that Maurice blogged about a while ago. There aren't many examples for this so here's another one for you.
The article doesn't have the downloadable source or built project so you can grab them from here: