Added quartz scheduler client
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
<!-- Nuget Package Details -->
|
<!-- Nuget Package Details -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>LiteCharms.Extensions</PackageId>
|
<PackageId>LiteCharms.Extensions</PackageId>
|
||||||
<Version>1.0.17</Version>
|
<Version>1.0.18</Version>
|
||||||
<Authors>Khwezi Mngoma</Authors>
|
<Authors>Khwezi Mngoma</Authors>
|
||||||
<Company>Lite Charms (PTY) Ltd</Company>
|
<Company>Lite Charms (PTY) Ltd</Company>
|
||||||
<Description>Extension components for Lite Charms applications.</Description>
|
<Description>Extension components for Lite Charms applications.</Description>
|
||||||
|
|||||||
@@ -7,6 +7,41 @@ public static class Quartz
|
|||||||
{
|
{
|
||||||
private const string databaseConfigName = "PostgresScheduler";
|
private const string databaseConfigName = "PostgresScheduler";
|
||||||
|
|
||||||
|
public static IServiceCollection AddQuartzSchedulerClient(this IServiceCollection services, string schedulerName, string schedulerId, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
var connectionString = configuration.GetConnectionString(databaseConfigName);
|
||||||
|
|
||||||
|
services.ConfigureCommon();
|
||||||
|
|
||||||
|
services.AddQuartz(config =>
|
||||||
|
{
|
||||||
|
config.SchedulerName = schedulerName;
|
||||||
|
config.SchedulerId = schedulerId;
|
||||||
|
|
||||||
|
config.UseSimpleTypeLoader();
|
||||||
|
config.UseDefaultThreadPool(options => options.MaxConcurrency = 0);
|
||||||
|
config.UseTimeZoneConverter();
|
||||||
|
|
||||||
|
config.UsePersistentStore(storage =>
|
||||||
|
{
|
||||||
|
storage.PerformSchemaValidation = false;
|
||||||
|
|
||||||
|
storage.UseSystemTextJsonSerializer();
|
||||||
|
storage.SetProperty("quartz.jobStore.clustered", "true");
|
||||||
|
storage.SetProperty("quartz.jobStore.tablePrefix", "quartz_");
|
||||||
|
|
||||||
|
storage.UsePostgres(connectionString!);
|
||||||
|
storage.UseClustering(cluster =>
|
||||||
|
{
|
||||||
|
cluster.CheckinInterval = TimeSpan.FromSeconds(30);
|
||||||
|
cluster.CheckinMisfireThreshold = TimeSpan.FromSeconds(2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
public static IServiceCollection AddQuartzScheduler(this IServiceCollection services, string schedulerName, string schedulerId, IConfiguration configuration)
|
public static IServiceCollection AddQuartzScheduler(this IServiceCollection services, string schedulerName, string schedulerId, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var connectionString = configuration.GetConnectionString(databaseConfigName);
|
var connectionString = configuration.GetConnectionString(databaseConfigName);
|
||||||
|
|||||||
Reference in New Issue
Block a user