[Quartz.NET]: Get Started

  • Post author:
  • Post category:Quartz
  • Post comments:1 Comment
  • Reading time:3 mins read

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: http://www.quartz-scheduler.net/documentation/quartz-2.x/quick-start.html

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!

This Post Has One Comment

Leave a Reply