Showing posts with label quartz. Show all posts
Showing posts with label quartz. Show all posts

Monday, June 21, 2010

Embeddable Quartz.Net web consoles

 

I wrote another embeddable web console (the third so far, the others being the NHibernate and the Boo console). This one is a manager for the Quartz.NET job scheduler.

Even though ASP.NET is not the perfect environment to run scheduled jobs, I do use Quartz.NET sometimes to schedule some non-critical maintenance jobs in web applications. And sometimes I need to pause or manually launch a job. So I went looking for a web interface and found two (quartznet-admin and Quartz.Web) but they're full ASP.NET MVC apps, not meant to be embeddable. So I built my own:

QuartzNetWebConsole

Project homepage
Downloads
Here are some screenshots showing its features, with a sample application:

Index / Dashboard:

qnindex

Triggers per group (the jobs per group page is very similar):

qntriggers

Scheduler log: 

qnlog

Log RSS:

qnrss

Setup:

  1. Reference QuartzNetWebConsole.dll in your application
  2. Add it to your httpHandlers in your web.config:
    <add verb="*" path="quartz/*" validate="false" type="QuartzNetWebConsole.ControllerFactory, QuartzNetWebConsole"/> 
  3. Configure it with QuartzNetWebConsole.Setup in your Application_Start(), e.g:
    protected void Application_Start(object sender, EventArgs e) {
    	Quartz.IScheduler scheduler = BuildQuartzScheduler();
    	QuartzNetWebConsole.Setup.Scheduler = () => scheduler;
    	...
    }
  4. Optionally, add a logger (any class implementing QuartzNetWebConsole.ILogger). An in-memory logger is provided:
    var partialQuartzConsoleUrl = string.Format("http://{0}:{1}/quartz/", Context.Request.Url.Host, Context.Request.Url.Port); // quartz web console url, required for RSS
    QuartzNetWebConsole.Setup.Logger = new QuartzNetWebConsole.MemoryLogger(1000, partialQuartzConsoleUrl); // stores 1000 log entries

As usual, it's up to you to secure it as you see fit.

Crystal Quartz

After I wrote this whole thing, I found another open source project (written a couple of months ago, it seems) that does about 80% of I needed! Apparently my google-fu failed me. Anyway, this project is called Crystal Quartz and was created by Guryanov Evgeniy. As far as I know, it hasn't been released and nobody has blogged about it, in fact the only reference I found was this message. I got the source code and gave it a try, and it looks good. Here are the screenshots:

Index:

cqindex

Job detail:

qcjob

Conclusions

So there you go, now you have two embeddable web managers for Quartz.NET to choose from.
One of the cool things about Quartz.NET is that it's easily remotable, so you can also use these managers with a Quartz.NET Windows Service, just by telling the web IScheduler to connect to a remote scheduler instance.

Wednesday, March 4, 2009

Windsor facility for Quartz.NET

A few months ago I wrote a couple of adapters to integrate Quartz.Net into Windsor. These were loose components that you had to register yourself and the configuration wasn't very friendly. So I decided to wrap them in a facility to make things cleaner and easier.

This is what the facility provides:

Here's what it doesn't support:

  • These entities are NOT Windsor-managed (they are instantiated normally by Quartz instead)
  • Trigger and job group names

Note that it's up to you to register jobs with the appropriate lifestyle. Listeners can only have singleton lifestyle since they're injected in IScheduler which is itself a singleton.

Here are the bits:

Wednesday, October 8, 2008

Basic Quartz.Net-Windsor integration

A couple of months or so ago, I had to code some periodic maintenance jobs to be run in-process. So I was faced with the same options that Ayende had a year ago (except the out-of-process options). I finally decided on using Quartz.NET, since I needed the dynamic update capabilities (that is, it watches the config file for changes and re-schedules accordingly) which Castle.Components.Scheduler doesn't have yet as far as I know... (BTW Castle.Components.Scheduler is now part of the trunk).

So I set to code the wrappers needed to make it play with Windsor, and the resulting code is here. There's a sample app that shows how to set up job and trigger listeners (both global and job-specific). The actual scheduling configuration is managed by Quartz.NET of course. In the sample I used the external quartz_jobs.xml config with the default RAMJobStore, but you could easily change that to a ADOJobStore or anything, just by setting the props dictionary on the QuartzNetScheduler component, that dictionary is passed as-is to Quartz.NET.

Why did I write "basic" integration on the title? Well, I just needed the basic features of Quartz.NET, so I didn't even try to integrate stuff like clustering, remote servers, etc. I have no idea if those will work with my code. If anyone gives it a try, I'd love to hear about it :-)

UPDATE 4/3/2009: I wrapped the components in a facility for easier usage and configuration.