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:

11 comments:

wayne-o said...

Hi

This is very interesting as we've just gone from castle.scheduler to quartz and would ideally like to use your integration!

I would love to help out if i can but my inderstanding of the nuts and bolts of castle are v.limited.

give me a shout if i can help :)

mausch said...

@wayne-o: great! We should move this discussion to the castle dev list. Create a new thread there and I'll get you up to speed.

wayne-o said...

FFR here is the link to that convo:
http://groups.google.com/group/castle-project-users/browse_thread/thread/1b5971028d05a2ab/9d2b197b9c20eb68?lnk=gst&q=QUARTZ#9d2b197b9c20eb68

Anonymous said...

Thanks this is really awesome! One question: how would I get a reference to the QuartzNetScheduler after it has been created through the windsor facility? I ask because I am using quartz from a windows service and I want to properly shut down the scheduler when the service is stopped.
Thanks

mausch said...

@Anonymous: resolve Quartz.IScheduler from Windsor.

Ciprian said...

I'm using this facility in my project and I'd like to have the jobs 'Transient'. By default, it seems they are singletons.
Is there a way to define the job LifeStyle like this:
container.Register(Component.For().ImplementedBy().LifeStyle.Transient);

or similar?

Thank you!
Ciprian

Ciprian said...

Ok, I've just succeed:

container.Register(Component.For().Named("sampleJob").LifeStyle.Transient);

Thanks!
Ciprian

Davide Icardi said...

Do you have any plan for implementing the facility for Quartz 2.0?
Do you need help? I can fork the project on github?

Thanks

Mauricio Scheffer said...

@Davide: sure, go ahead and fork it.

Mihir Mone said...

hey mauricio, do you have any plans of providing castle integration the latest build of quartz together?

We would like to use quartz 2.1.2 and castle 3.0.0.

Mauricio Scheffer said...

@Mihir : I upgraded the package to Castle 3.2 and Quartz 2.x about a month ago: http://nuget.org/packages/Quartz.Windsor/

Please use the issue tracker or the Castle mailing list for any other questions about this.