Skip to content

Latest commit

 

History

History
39 lines (33 loc) · 2.03 KB

README.md

File metadata and controls

39 lines (33 loc) · 2.03 KB

CosmosDb Job Store for Quartz.NET Downloads

We have created this project to allow clustered Quartz.NET store jobs into CosmosDb. It is more or less port of Quartz.NET MongoDb Job Store.

Basic Usage

var properties = new NameValueCollection();
properties[StdSchedulerFactory.PropertySchedulerInstanceName] = instanceName;
properties[StdSchedulerFactory.PropertySchedulerInstanceId] = $"{Environment.MachineName}-{Guid.NewGuid()}";
properties[StdSchedulerFactory.PropertyJobStoreType] = typeof(CosmosDbJobStore).AssemblyQualifiedName;
properties[$"{StdSchedulerFactory.PropertyObjectSerializer}.type"] = "json";
properties[$"{StdSchedulerFactory.PropertyJobStorePrefix}.Endpoint"] = "https://localhost:8081/";
properties[$"{StdSchedulerFactory.PropertyJobStorePrefix}.Key"] = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
properties[$"{StdSchedulerFactory.PropertyJobStorePrefix}.DatabaseId"] = "quartz-demo";
properties[$"{StdSchedulerFactory.PropertyJobStorePrefix}.CollectionId"] = "Quartz";
properties[$"{StdSchedulerFactory.PropertyJobStorePrefix}.Clustered"] = "true";

var scheduler = new StdSchedulerFactory(properties);
return scheduler.GetScheduler();

Collection partition key

By default Cosmos DB collection partitioned by PropertySchedulerInstanceName, instead entity type (e.g. 'Trigger', 'JobDetails') can be used as the partition key.

properties[$"{StdSchedulerFactory.PropertyJobStorePrefix}.{nameof(CosmosDbJobStore.PartitionPerEntityType)}"] = "true";

ConnectionMode

By default the Cosmos DB connectionMode is Direct, instead Gateway can be used as connectionMode.

properties[$"{StdSchedulerFactory.PropertyJobStorePrefix}.ConnectionMode"] = ((int)ConnectionMode.Gateway).ToString();

Nuget

Install-Package Quartz.Spi.CosmosDbJobStore