/jobbr-server

Jobbr is a non-invasive .NET JobServer

Primary LanguageC#GNU General Public License v3.0GPL-3.0

Jobbr Build status

Jobbr is a .NET job server. It is designed to reduce artifical complexity when a job server is needed in a project. Jobbr tries to get out of your way as much as possible so that you can focus on business logic. Job implementations have no dependency to Jobbr which makes it easy to integrate Jobbr in any .NET project.

Master build status NuGet-Stable
Develop build status NuGet Pre-Release

Main Features

  • Isolation of Jobs on process-level
  • REST API to manage and trigger Jobs and watch the execution state
  • Provides a typed client to consume the REST API
  • Persists created files from running jobs in an artefact store.
  • Supports CRON expressions for recurring triggers
  • Embeddable in your own C# application (JobServer and Runner)
  • Easily testable
  • IOC for your jobs
  • Extendable (jobstorage providers, artefact storage providers, execution etc)
  • Progress tracking via stdout (Console.WriteLine())

QuickStart

The best way to get started is to check out the demo repo to see a running example of Jobbr.

Implementing a job

Good news! All your C#-Code is compatible with jobbr as long as the CLR-type can be instantiated and has at least a public Run()- Method.

public class SampleJob
{
    public void Run()
    {
        const int iterations = 15;

        for (var i = 0; i < iterations; i++)
        {
            Thread.Sleep(500);

            Console.WriteLine("##jobbr[progress percent='{0:0.00}']", (double)(i + 1) / iterations * 100); // optional: report progress
        }
    }
}

Configuring job with triggers

To define jobs use the AddJobs extension method:

jobbrBuilder.AddJobs(repo =>
{
    // define one job with two triggers
    repo.Define("SampleJob", "Quickstart.SampleJob")
        .WithTrigger(DateTime.UtcNow.AddHours(2)) /* run once in two hours */
        .WithTrigger("* * * * *"); /* run every minute */
});

If you need to add triggers at runtime head over to the REST API component which also includes a typed client. The REST API is optional and has to be plugged in if needed.

Persistence

There are two different storages:

  • Storage: stores jobs, triggers and jobruns
  • ArtefactStorage: stores files created by running jobs

By default Jobbr runs in memory, thus all data is lost when Jobbr is restarted. To keep the data configure one of the storage providers:

Storage

ArtefactStorage

License

This software is licenced under GPLv3. See LICENSE, please see the related licences of 3rd party libraries below.

Acknowledgements

Jobbr Server is based on following great open source projects:

Credits

This application was built by the following awesome developers: