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:

16 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.

nub340 said...

@wayne-o: Thanks this looks awesome but unfortunately it's not working for me. I keep getting an error saying it could not load assembly Quartz, Version=2.2.400.0. However, when I look in my packages folder I see the version of Quartz nuGet actually downloaded is 2.2.2.4. I tried to download your source project so I could re-compile it with Quartz 2.2.2.4 version but all the references are duplicated/messed up. I tried resolving them but then I get a whole bunch of other errors. *sigh* Anyhow, I figured this might be something you could fix really fast before I went to crazy trying to fix it myself. Please let me know if I am doing anything wrong. Thanks again!

Mauricio Scheffer said...

@nub340 What specifically are you talking about? If there are issues with this Windsor facility please post them to https://github.com/castleprojectcontrib/QuartzNetIntegration/issues

nub340 said...

@wayne-o: Thanks for the quick response! Okay I created an issue on GitHub for this: https://github.com/castleprojectcontrib/QuartzNetIntegration/issues/13


Mauricio Scheffer said...

@nub240 Just to clear things up: I'm not wayne-o, my name is Mauricio Scheffer, I'm the author of the project and this post.

nub340 said...

I see sorry for the mix-up.