Building a schedule manager with Quartz
Contents
- Introduction
- Prerequisites
- Schedule manager
- Putting it all together
Introduction
Create simple schedule manager using Quartz library (https://www.quartz-scheduler.net/)
Prerequisites
- IDE: Microsoft Visual Studio or Visual Studio Code
- NuGet packages:
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
Post a Comment