Scheduled tasks with Quartz.NET

I’ve used a few different task schedulers on my current project, where I have to kick off NServiceBus sagas at very specific times of day (every night at 2AM etc.) We started out using the built-in Windows Task Scheduler, which provides decent logging, very flexible scheduling, retry, etc. capabilities. The only problem is that the actual piece doing the work is just a console app that gets kicked off.

This got annoying because we’d see spikes in memory usage to spin up a process just to send a message. We also didn’t have any control or hook into the actual execution of jobs, to do things like advanced logging and so on. We modified our executables to do so, but eventually we found that it became difficult to discern the work being done with just executing a job.

We’ve also tried commercial task scheduling options that had advanced workflow building capabilities. But just because I drag and drop tasks in a UI doesn’t mean it’s not code. It is.

I happened to stumble on a project of a task scheduler engine sourced entirely in .NET: Quartz.NET. It’s a port of a Java project, which confused me at first, since shouldn’t it be called nQuartz ;)

It’s pretty much exactly what you’d expect from a job scheduler library intended to run in .NET – IoC support, storing jobs/log in a database, plugin points at various levels, support for transactions and more. Another cool little library allowing me to push more behavior into code.

As an aside, the big reason I don’t like UI-based workflow applications is that I very rarely have the flexibility to reduce workflow duplication as I do in a full OO environment that I do in .NET.

Related Articles:

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

About Jimmy Bogard

I'm a technical architect with Headspring in Austin, TX. I focus on DDD, distributed systems, and any other acronym-centric design/architecture/methodology. I created AutoMapper and am a co-author of the ASP.NET MVC in Action books.
This entry was posted in Tools. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://mutedsolutions.com Derick Bailey

    a few years ago i was looking for the quartz.net project, so to http:// quartz.net … while i was at work … and boy was i in for a surprise. a word of advice: google the project instead of just typing in a url, or you may end up with an NSFW site showing up on your laptop. :P

    • http://www.mattjcowan.com/ mattjcowan

      Hey, that’s kind of funny. That happened to me once before, and I was with a client at the time. Oh, my!! We all laughed it off though. http:// quartz .net is a 502 these days.

  • Anonymous

    lmao, yea Derick – that happened to me too – be very careful ;-)

  • http://kennyeliasson.myopenid.com/ Kenny Eliasson

    Did use Quartz on a project a couple of months ago. Worked perfect, highly recommended.

  • http://profiles.google.com/schutte.pieter Pieter Schutte

    We are using Quartz.NET on our current project, and it is brilliant. Mauricio Scheffer has a Windsor facility to make even easier.

    http://bugsquash.blogspot.com/2009/03/windsor-facility-for-quartznet.html

  • http://jeah.myopenid.com/ smartcaveman

    @jimmybogard, Please weigh in on this SO topic. http://stackoverflow.com/questions/4663577/automapper-vs-valueinjecter . I’m a huge fan of AutoMapper and have read both versions of ASP.NET MVC in Action. A lot of developers have to make this decision and this discussion is extremely lopsided. Thank you. P.S. I understand this is not the most appropriate place to post this, but I was unable to find a public email address. Feel free to delete my comment after you have received it.