Job.Scheduler 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Job.Scheduler --version 1.0.1
                    
NuGet\Install-Package Job.Scheduler -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Job.Scheduler" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Job.Scheduler" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Job.Scheduler" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Job.Scheduler --version 1.0.1
                    
#r "nuget: Job.Scheduler, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Job.Scheduler&version=1.0.1
                    
Install Job.Scheduler as a Cake Addin
#tool nuget:?package=Job.Scheduler&version=1.0.1
                    
Install Job.Scheduler as a Cake Tool

Job Scheduler

A simple job scheduling library relying on the async/await pattern in C#.

Type of Jobs

One Time Job

By implementing the IJob interface you tell the scheduler that you just want this job to be executed once and directly upon being scheduled.

Recurring Job

By implementing the IRecurringJob the scheduler will run indefinitely your job with the given delay between execution.

Delayed Job

By implementing the IDelayedJob you tell the scheduler to wait a delay before executing your job.

Usage

I advise you to use a Dependency Injection (DI) engine (like SimpleInjector) to register the JobRunnerBuilder and JobScheduler as singleton.

Example:

public class MyJob : IRecurringJob
{
    public async Task ExecuteAsync(CancellationToken cancellationToken)
    {
        //Your complex recurring code, here pretty simple
        await Console.Out.WriteLineAsync("Hello World");
    }

    public Task<bool> OnFailure(JobException exception)
    {
//Any exception that occured when executing your job will be wrapped in a JobException, check the InnerException
//for you to be able to handle a failure without breaking your application neither needed a try/catch in ExecuteAsync

//Continue to run if the job has failed
//You can handle your self what to do in case of failure
//Returning false, will make the job stop
        return Task.FromResult(true);
    }
//This job will run every 15 seconds

    public TimeSpan Delay { get; } = TimeSpan.FromSeconds(15);
}

var builder = new JobRunnerBuilder();
var scheduler = new JobScheduler(builder);

//If you have already a cancellation token that you want to be used for stopping your job, you can pass it as second param
scheduler.Start(new MyJob());

//At the end of your application, you can ask the Scheduler to gracefully stop the running jobs and wait for them to stop.
//You can also pass a cancellationToken to force a non graceful cancellation of the jobs.
await scheduler.StopAsync();
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Job.Scheduler:

Package Downloads
Job.Scheduler.AspNetCore

A simple job scheduling library relying on the async/await pattern in C#. Supports Recurring Jobs, Delayed Jobs and One Time Jobs. Helper for ASP.NET Core.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Job.Scheduler:

Repository Stars
Belphemur/SoundSwitch
C# application to switch default playing device. Download: https://soundswitch.aaflalo.me/
Version Downloads Last updated
3.1.8 3,803 12/14/2023
3.1.7 186 12/14/2023
3.1.6 1,653 2/9/2023
3.1.5 435 2/9/2023
3.1.4 437 2/9/2023
3.1.3 471 2/5/2023
3.1.2 456 2/5/2023
3.1.1 933 11/27/2022
3.1.0 558 11/27/2022
3.0.2 1,208 10/5/2022
3.0.1 772 10/4/2022 3.0.1 is deprecated because it has critical bugs.
3.0.0 751 10/4/2022 3.0.0 is deprecated because it has critical bugs.
2.9.0 1,605 7/13/2022
2.8.0 766 7/12/2022
2.7.3 1,925 5/9/2022
2.7.2 720 5/9/2022
2.7.1 1,002 4/17/2022
2.7.0 730 4/16/2022
2.6.0 761 4/16/2022
2.5.1 756 4/16/2022
2.5.0 1,127 10/5/2021
2.4.1 422 9/28/2021
2.4.0 419 9/27/2021
2.3.0 1,053 7/27/2021
2.2.2 508 7/15/2021
2.2.1 554 5/22/2021
2.2.0 601 5/15/2021
2.1.1 436 4/13/2021
2.1.0 444 4/8/2021
2.0.2 441 3/22/2021
2.0.1 453 3/22/2021
2.0.0 416 3/19/2021
1.1.0 593 12/23/2020
1.0.1 660 10/24/2020
1.0.0 669 10/24/2020