basquang™ on clouds

August 4, 2014

[Quartz.NET]: Get Started

Filed under: Quartz,Quartz.NET — basquang @ 4:32 PM
Tags: ,

What is Quartz.NET?

“Quartz.NET is a full-featured, open source job scheduling system that can be used from smallest apps to large scale enterprise systems. ”

Quartz.NET is a pure .NET library written in C# and is a port of very popular open source Java job scheduling framework, Quartz. This project owes very much to original Java project, it’s father James House and the project contributors.

How to get started?

The official guide here:

And the steps here:

  1. Create Console Application
  2. Install Quartz.NET from NuGet package by running following command

    Install-Package Quartz

    Quartz NuGet will install following packages at this time I writing the blog post

      <package id="Common.Logging" version="2.1.2" targetFramework="net45" />
      <package id="Quartz" version="2.2.4" targetFramework="net45" />
  3. Add following code in the namespace
  4. Program class

    class Program
            static void Main(string[] args)
                    //Configure simple logging
                    Common.Logging.LogManager.Adapter = new Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter { Level = Common.Logging.LogLevel.Info };
                    // Grab the Scheduler instance from the Factory 
                    IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler();
                    // and start it off
                    // define the job and tie it to our HelloJob class
                    IJobDetail job = JobBuilder.Create<HelloJob>()
                        .WithIdentity("job1", "group1")
                    // Trigger the job to run now, and then repeat every 10 seconds
                    ITrigger trigger = TriggerBuilder.Create()
                        .WithIdentity("trigger1", "group1")
                        .WithSimpleSchedule(x => x
                    // Tell quartz to schedule the job using our trigger
                    scheduler.ScheduleJob(job, trigger);
                    // some sleep to show what's happening
                    // and last shut down the scheduler when you are ready to close your program
                catch (SchedulerException se)
                Console.WriteLine("Press any key to close the application");

    Job class

    public class HelloJob : IJob
            public void Execute(IJobExecutionContext context)
                Console.WriteLine("Greetings from HelloJob!");
  5. The output like this.

Hope this help!

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: