ReCron 0.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package ReCron --version 0.2.1
NuGet\Install-Package ReCron -Version 0.2.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="ReCron" Version="0.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ReCron --version 0.2.1
#r "nuget: ReCron, 0.2.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.
// Install ReCron as a Cake Addin
#addin nuget:?package=ReCron&version=0.2.1

// Install ReCron as a Cake Tool
#tool nuget:?package=ReCron&version=0.2.1

ReCron

NuGet Github Workflow Contributors Downloads

ReCron is a fully-featured .NET library for creating and running Cron/Scheduled jobs using background service for .NET Core 3.1, .NET 5 and upwords.

Compatibility

.NET Version Supported Remark
.NET 6
.NET 5
.NET Core 3.1
.NET Core (1.0 - 3.0) This library is targeting .NET Core 3.1, .NET 5 ++
.NET Framework (1.0 - 4.8) This library is targeting .NET Core 3.1, .NET 5 ++

Installation

Package Manager

Install-Package ReCron -Version 0.2.1

.NET CLI

dotnet add package ReCron --version 0.2.1

Package Reference

<PackageReference Include="ReCron" Version="0.2.1" />

Usage

  1. Create a job class by inheriting CronWorkerService class and implement WorkerProcess method.
class TestJob : CronWorkerService
{
    public TestJob(IWorkerConfig<TestJob1> config, ILogger<TestJob1> logger) : base(config.CronExpression, TimeZoneInfo.Local)
    {

    }
    protected override async Task WorkerProcess(CancellationToken stoppingToken)
    {
        await Task.Run(() => Console.WriteLine("TestJob\t" + DateTime.Now.ToString()));
    }
}
  1. Inject your job with cron expression and TimeZoneInfo
services.AddCronWorker<TestJob>(config =>
{
    config.CronExpression = "*/1 * * * * *";
    config.TimeZoneInfo = TimeZoneInfo.Local;
});
  • To get currently injected Jobs with status:
ReCronContainer.GetWorkers();
  • Worker/Job status is an enum
public enum WorkerStatus
{
    Added = 0,
    Running = 1,
    Stopped = 2,
}
  • To stop a job:
ReCronContainer.StopWorker(name);
// name is fully qualified name of job class
  • To start a job:
ReCronContainer.StartWorker(name);
// name is fully qualified name of job class

For working examples see /demos directory.

Contribution

Authors

  • Rasedur Rahman Roxy - Planning and Development - Twitter

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Hat tip to anyone whose code was used
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.0 394 8/24/2022
0.2.1 406 5/10/2022
0.2.0 387 5/9/2022