ReCron 0.2.1
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Core 3.1
This package targets .NET Core 3.1. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ReCron
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
- Create a job class by inheriting
CronWorkerService
class and implementWorkerProcess
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()));
}
}
- 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 | Versions 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.
-
.NETCoreApp 3.1
- Cronos (>= 0.7.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
-
net5.0
- Cronos (>= 0.7.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
-
net6.0
- Cronos (>= 0.7.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.