Building a schedule manager with Quartz

Contents

  1. Introduction
  2. Prerequisites
  3. Schedule manager
  4. Putting it all together

Introduction

Create simple schedule manager using Quartz library (https://www.quartz-scheduler.net/)

Prerequisites

Schedule manager

The schedule manager allows you to:
  • start the schedule manager
  • suspend jobs firing for the schedule manager
  • stop the schedule manager
  • schedule a job (CRON trigger + timezone or Quartz trigger)
  • unschedule a job
  • run a job on demand
Usage:


ScheduleManager.Instance.Start();

// schedule an every 15 seconds test job
ScheduleManager.Instance.ScheduleJob<TestJob>("testJob", "testGroup", "0/15 * * * * ?");

// some sleep to show what's happening
Task.Delay(TimeSpan.FromSeconds(60)).Wait();

ScheduleManager.Instance.Stop();

Putting it all together

The source code can be found on GitHub at:

Comments

Popular Posts