Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JezhikLaas/quartznet-RavenJobStore
https://github.com/JezhikLaas/quartznet-RavenJobStore
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/JezhikLaas/quartznet-RavenJobStore
- Owner: JezhikLaas
- License: apache-2.0
- Created: 2023-11-08T07:40:27.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-12-18T14:39:04.000Z (11 months ago)
- Last Synced: 2023-12-19T10:55:58.824Z (11 months ago)
- Language: C#
- Size: 430 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![build and test](https://github.com/JezhikLaas/quartznet-RavenJobStore/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/JezhikLaas/quartznet-RavenJobStore/actions/workflows/build-and-test.yml)
[![Qodana](https://github.com/JezhikLaas/quartznet-RavenJobStore/actions/workflows/code_quality.yml/badge.svg)](https://github.com/JezhikLaas/quartznet-RavenJobStore/actions/workflows/code_quality.yml)
# Quartz.NET-RavenJobStore
JobStore implementation for Quartz.NET scheduler using RavenDB.
Not exactly a fork of, but inspired by [Quartz.NET-RavenDB](https://github.com/ravendb/quartznet-RavenDB)## About
[Quartz.NET](https://github.com/quartznet/quartznet) is a full-featured, open source job scheduling system that can be used from smallest apps to large scale enterprise systems.
[Quartz.NET on RavenDB](https://github.com/JezhikLaas/quartznet-RavenJobStore) is a provider written for Quartz.NET which lets us use the [RavenDB](https://ravendb.net/features) NoSQL database as the persistent Job Store for scheduling data (instead of the SQL solutions that are built-in Quartz.NET).
## Project goals
* Can handle high volumes of jobs and triggers.
* Suitable for clustered schedulers.
* Different schedulers (instance names) can share the same database.## How to get started
First add scheduling to your app using Quartz.NET ([example](http://www.quartz-scheduler.net/documentation/quartz-2.x/quick-start.html)).
Then install the NuGet [package](https://www.nuget.org/packages/Domla.Quartz.RavenJobStore/).You can either let the package create a IDocumentStore on its own:
```csharp
using Domla.Quartz.Raven;
using Quartz;
using Quartz.Impl.RavenStore.Example;
using Raven.Client.Documents;
using Raven.Client.Documents.Conventions;CreateFromProperties().Run();
IHost CreateFromProperties() =>
Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddHostedService();services.AddQuartz(quartz =>
{
// Quartz insists on selecting a serializer.
quartz.SetProperty("quartz.serializer.type", "binary");// Configure thread pool size for Quartz,
// not directly to RavenJobStore.
quartz.UseDefaultThreadPool(pool => pool.MaxConcurrency = 10);quartz.UsePersistentStore(store =>
{
// Tell Quartz to use RavenJobStore as store backend,
// creating a DocumentStore along the way.
store.UseRavenDb(configuration =>
{
// To run this demo you need to have running RavenDB at http://localhost:8080.
// Or use a different URL which suits your needs.
configuration.Urls = new[] { "http://localhost:8080" };// The database is expected to be created.
configuration.Database = "QuartzDemo";// Time to wait for non-stale query results.
configuration.SecondsToWaitForIndexing = 15; // default// How often to retry an operation when failed because of a concurrency exception.
configuration.ConcurrencyErrorRetries = 100; // default// Just for the record - you can prefix the collection
// names for our classes with a common name.
// configuration.CollectionName = "Name";// Path to a raven client certificate
// configuration.CertPath = "certificate.pem";// Password for the certificate.
// configuration.CertPass = "secret-password";
});
});
});
services.AddQuartzHostedService(quartz => quartz.WaitForJobsToComplete = true);
})
.Build();```
or you can create and configure your own IDocumentStore and let the JobStore use it:
```csharp
using Domla.Quartz.Raven;
using Quartz;
using Quartz.Impl.RavenStore.Example;
using Raven.Client.Documents;
using Raven.Client.Documents.Conventions;CreateWithOwnDocumentStore().Run();
IHost CreateWithOwnDocumentStore() =>
Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
// Build and register a Raven document store as usual.
var conventions = new DocumentConventions
{
UseOptimisticConcurrency = true
};
var documentStore = new DocumentStore
{
Conventions = conventions,
// To run this demo you need to have running RavenDB at http://localhost:8080.
// Or use a different URL which suits your needs.
Urls = new[] { "http://localhost:8080" },
// The database is expected to be created.
Database = "QuartzDemo"
};documentStore.Initialize();
services.AddSingleton(documentStore);
services.AddHostedService();
services.AddQuartz(quartz =>
{
// Quartz insists on selecting a serializer.
quartz.SetProperty("quartz.serializer.type", "binary");// Configure thread pool size for Quartz,
// not directly to RavenJobStore.
quartz.UseDefaultThreadPool(pool => pool.MaxConcurrency = 10);// Yes, it is that simple.
quartz.UsePersistentStore(store => store.UseRavenDb(services));
});services.AddQuartzHostedService(quartz => quartz.WaitForJobsToComplete = true);
})
.Build()
.UseRavenJobStoreLogging();```