Coder Social home page Coder Social logo

quartznet-litedb's Introduction

Quartz.NET-LiteDB

Build status Nuget

JobStore implementation for Quartz.NET scheduler using LiteDB.

About

Quartz.NET is a full-featured, open source job scheduling system that can be used from smallest apps to large scale enterprise systems. Quartz.NET on LiteDB is a new provider written for Quartz.NET which lets us use the LiteDB NoSQL database as the persistent Job Store for scheduling data (instead of the SQL solutions that are built-in Quartz.NET).

Quartz.NET on LiteDB is a provider that is forked and adapted to LiteDB from Quartz.NET on RavenDB.

Installation

First add scheduling to your app using Quartz.NET (example). Then install the NuGet package.

Configuration & Usage

.NET Framework

In your code, where you would have normally configured Quartz to use a persistent job store, you must add the following configuration properties:

// In your application where you want to setup the scheduler:
NameValueCollection properties = new NameValueCollection
{
    // Normal scheduler properties
    ["quartz.scheduler.instanceName"] = "TestScheduler",
    ["quartz.scheduler.instanceId"] = "instance_one",
    ["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz",
    ["quartz.threadPool.threadCount"] = "1",
    ["quartz.threadPool.threadPriority"] = "Normal",
    // LiteDB JobStore property
    ["quartz.jobStore.type"] = "Quartz.Impl.LiteDB.LiteDbJobStore, Quartz.Impl.LiteDB"
    // LiteDB Connection String
    ["quartz.jobStore.connectionString"] = "Filename=Quartz-Demo.db;",
};
// Init scheduler with the desired configuration properties
ISchedulerFactory sf = new StdSchedulerFactory(properties);
IScheduler scheduler = sf.GetScheduler();

.NET Core

For use in .NET Core Workers or ASP.NET Core use the recommended Fluent API when setting up a Quartz in ConfigureServices like:

var configuration = new ConfigurationBuilder()
                        .AddJsonFile("appsettings.json")
                        .Build();
var section = configuration.GetSection("MyService");
var config = section.Get<MyServiceConfig>();
services.AddQuartz(q =>
    {
        q.UseMicrosoftDependencyInjectionJobFactory();
        q.UseDefaultThreadPool(tp =>
        {
            tp.MaxConcurrency = 10;
        });
        q.UsePersistentStore(s =>
        {
            s.UseLiteDb(options =>
            {
                options.ConnectionString = "Filename=Quartz-Worker.db";
            });
            s.UseBinarySerializer();
        });
        
        // Add jobs and triggers as you wish
    }
);
services.AddQuartzHostedService(
    q => q.WaitForJobsToComplete = true);

quartznet-litedb's People

Contributors

nefarius avatar iftahbe avatar ayende avatar valkarin avatar mumusbtc avatar tomsawdayee avatar

Stargazers

Zoey avatar

quartznet-litedb's Issues

Does not support trim

Error:

fail: Microsoft.Extensions.Hosting.Internal.Host[11]
      Hosting failed to start
      Quartz.SchedulerException: JobStore of type 'Quartz.Impl.LiteDB.LiteDbJobStore' could not be instantiated.
       ---> System.ArgumentException: Cannot instantiate type which has no empty constructor (Parameter 'LiteDbJobStore')
         at Quartz.ExceptionHelper.ThrowArgumentException(String, String)
         at Quartz.Util.ObjectUtils.InstantiateType[T](Type)
         at Quartz.ServiceCollectionSchedulerFactory.InstantiateType[T](Type)
         at Quartz.Impl.StdSchedulerFactory.Instantiate()
         --- End of inner exception stack trace ---
         at Quartz.Impl.StdSchedulerFactory.Instantiate()
         at Quartz.Impl.StdSchedulerFactory.GetScheduler(CancellationToken )
         at Quartz.ServiceCollectionSchedulerFactory.GetScheduler(CancellationToken )
         at Quartz.QuartzHostedService.StartAsync(CancellationToken)
         at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
         at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1, CancellationToken, Boolean, Boolean, List`1, Func`3) [See nested exception: System.ArgumentException: Cannot instantiate type which has no empty constructor (Parameter 'LiteDbJobStore')
         at Quartz.ExceptionHelper.ThrowArgumentException(String, String)
         at Quartz.Util.ObjectUtils.InstantiateType[T](Type)
         at Quartz.ServiceCollectionSchedulerFactory.InstantiateType[T](Type)
         at Quartz.Impl.StdSchedulerFactory.Instantiate()]

refer to this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.