Skip to content
This repository was archived by the owner on Dec 16, 2023. It is now read-only.

idfy-io/quartznet-extensions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

quartznet-extensions

Provides helper methods for configuring Quartz.NET scheduler with a persistent JobStore.

Usage

Below are some examples on how to create a new scheduler. Note that InstanceName must be a unique identifier for your scheduler and is used to distinguish schedulers that are using the same JobStore.

See Quartz Configuration Reference for information about the available configuration properties.

Database tables are not created automatically. The required tables must first be created by running the provided script.

SqlServer

Database script: https://github.com/quartznet/quartznet/blob/master/database/tables/tables_sqlServer.sql

With default configuration:

IScheduler scheduler = await SqlServerSchedulerFactory.GetDefaultScheduler("InstanceName", "ConnectionString");
await scheduler.Start();

With custom configuration:

var config = new QuartzSqlServerConfiguration("InstanceName", "ConnectionString") {
    ThreadPool = new QuartzThreadPoolConfiguration()
    {
      ThreadCount = 10
    }
};

IScheduler scheduler = await SqlServerSchedulerFactory.GetDefaultScheduler(config);
await scheduler.Start();

PostgreSQL

Database script: https://github.com/quartznet/quartznet/blob/master/database/tables/tables_postgres.sql

With default configuration:

IScheduler scheduler = await PostgreSqlSchedulerFactory.GetDefaultScheduler("InstanceName", "ConnectionString");
await scheduler.Start();

With custom configuration:

var config = new QuartzPostgreSqlConfiguration("InstanceName", "ConnectionString") {
    ThreadPool = new QuartzThreadPoolConfiguration()
    {
      ThreadCount = 10
    }
};

IScheduler scheduler = await PostgreSqlSchedulerFactory.GetDefaultScheduler(config);
await scheduler.Start();