Skip to content

codeyu/Hangfire.LiteDB

Repository files navigation

Hangfire.LiteDB

NuGet Badge MyGet Pre Release

Build Status

Platform Master
Windows Build status
Linux / OS X Build Status

Overview

LiteDB job storage for Hangfire

Usage

This is how you connect to an litedb instance

GlobalConfiguration.Configuration.UseLiteDbStorage();

To enqueue a background job you must have the following in the code somewhere at least once or the background job queue will not process

var client = new BackgroundJobServer();
\\then you can do this, which runs once
BackgroundJob.Enqueue(() => Console.WriteLine("Background Job: Hello, world!"));

Delayed tasks

Scheduled background jobs are being executed only after given amount of time.

BackgroundJob.Schedule(() => Console.WriteLine("Reliable!"), TimeSpan.FromDays(7));

Recurring tasks

Recurring jobs were never been simpler, just call the following method to perform any kind of recurring task using the CRON expressions.

RecurringJob.AddOrUpdate(() => Console.WriteLine("Transparent!"), Cron.Daily);

Continuations

Continuations allow you to define complex workflows by chaining multiple background jobs together.

var id = BackgroundJob.Enqueue(() => Console.WriteLine("Hello, "));
BackgroundJob.ContinueWith(id, () => Console.WriteLine("world!"));

License

Hangfire.LiteDB is released under the MIT License.

Known Bugs

  • UTC Time Zone and Local Time Zone is confusing.