Sunday, January 30, 2011

New in Quartz.Net 2.0–The Calendar Interval Trigger

NOTE: I'm now blogging at http://jayvilalta.com/blog and not updating this blog anymore. For information on the latest version of Quartz.Net, visit me there.

This is the first post of what will become a series of posts highlighting the new features that will be available in Quartz.Net 2.0.
To kick off the series, we will take a look at the CalendarIntervalTrigger. This trigger is used to fire jobs based on a recurring calendar time interval. The following time intervals are available:
IntervalUnit
Minute
Hour
Day
Week
Month
Year
This trigger has a RepeatInterval property, which can be used to indicate that the trigger should fire every N intervals. For example, if you set the RepeatIntervalUnit to Week and the RepeatInterval to 2, your trigger will fire every two weeks.
Here is what the source code documentation says about this trigger:
A concrete ITrigger that is used to fire a IJobDetail based upon repeating calendar time intervals.
The trigger will fire every N (see RepeatInterval) units of calendar time (see RepeatIntervalUnit) as specified in the trigger's definition.  This trigger can achieve schedules that are not possible with ISimpleTrigger (e.g because months are not a fixed number of seconds) or ICronTrigger (e.g. because "every 5 months" is not an even divisor of 12).
If you use an interval unit of IntervalUnit.Month then care should be taken when setting the startTime value that is on a day near the end of the month.  For example, if you choose a start time that occurs on January 31st, and have a trigger with unit IntervalUnit.Month and interval 1, then the next fire time will be February 28th, and the next time after that will be March 28th - and essentially each subsequent firing will occur on the 28th of the month, even if a 31st day exists.  If you want a trigger that always fires on the last day of the month - regardless of the number of days in the month, you should use ICronTrigger.
That’s it for today’s “New in Quartz.Net 2.0” post. Stay tuned for more, coming soon!

Friday, January 28, 2011

Installing Quartz.Net 2.0 as a Windows Service

NOTE: I'm now blogging at http://jayvilalta.com/blog and not updating this blog anymore. For information on the latest version of Quartz.Net, visit me there.

UPDATE: I've written a new post that has been updated with the release of Beta 1. Take a look at this newer post instead.
Quartz.Net 2.0 is currently under development. No official release (beta or otherwise) is available yet but if you really want to get started with it, you can download the source code from Github and build it yourself. In this post I am going to describe how to install the latest version of Quartz.Net 2.0 from source.

Getting the Source

If you are familiar with Git, Github and how it works, then just download the repository locally using whatever method you prefer. There are a lot of posts and even a free book on how to use Git, so I am not going to go over that stuff here.
If you’re not familiar with how to use Git or Github, then go ahead and download a zipped file of the source from here.
At this point I am going to assume that you have already downloaded the Quartz.Net source code and that it is in a folder somewhere on your drive. On my box I have downloaded the source to C:\git\quartznet, and the image below shows what that folder looks like. Your folder should look similar to the screenshot below.
image

Building The Source Code

Since this post is about installing Quartz.Net 2.0 as a windows service, let’s build the server project.
Instructions for Visual Studio 2008 and .Net 3.5
Double click on the Quartz.Server.2008.sln file if you have Visual Studio 2008 installed. This will open the file in VS 2008. Build the solution by pressing F6. This will build the binaries targeting the 3.5 framework. The build output for this project can be found under the build\3.5\Debug\Quartz.Server folder, as shown below.
image
Instructions for Visual Studio 2010 and .Net 4.0
If you have Visual Studio 2010 installed, double click on the Quartz.Server.2010.sln file to open it in VS 2010. Build the solution by pressing F6. This will build the binaries targeting the 4.0 framework. The build output for this project can be found under the build\4.0\Debug\Quartz.Server folder, as shown below.
image

Installing Quartz.Net 2.0 as a Windows Service

Now that you have built the source code, let’s install the service. Open a command prompt as administrator (if you are running a Vista or later OS) and cd to the directory that contains the Quartz.Server.exe file. This directory will be different based on whether you use VS 2008 or VS 2010, so double check that the file exists first in one of the paths that I mention above. At this point, all that is left is to install the service. Type the following into your command prompt:
Quartz.Server.exe install
If all goes well, then you should see the following in your command prompt window (replace 3.5 with 4.0 where appropriate):
image
By default, the service is installed with a startup type of automatic and under the Local System account. To uninstall, type the following into your command prompt:
Quartz.Server.exe uninstall
Now, go fire that puppy up and start experimenting!
As always, let me know in the comments if this stuff is useful and what topics you’re interested in reading about.

Tuesday, January 18, 2011

Quartz.Net Library is Available on NuGet

NOTE: I'm now blogging at http://jayvilalta.com/blog and not updating this blog anymore. For information on the latest version of Quartz.Net, visit me there.

The Quartz.Net library has been uploaded to NuGet. If you’re using Quartz.Net and NuGet, this should help you with setting up your environment and in keeping things current. The Common.Logging and the Common.Logging.Log4net and Log4net libraries are on NuGet as well. These are all required dependencies for running Quartz.Net with Log4net.

Saturday, January 15, 2011

Quartz.Net Development is Moving to Github

NOTE: I'm now blogging at http://jayvilalta.com/blog and not updating this blog anymore. For information on the latest version of Quartz.Net, visit me there.

In case you didn’t know it yet, development of Quart.Net is moving from Sourceforge to Github. If you want to follow development of the latest version of Quartz.Net. be sure and check out the project on Github. This should make it easier for everybody to contribute any changes to the project.