Cronograph.MongoDb
1.0.70
dotnet add package Cronograph.MongoDb --version 1.0.70
NuGet\Install-Package Cronograph.MongoDb -Version 1.0.70
<PackageReference Include="Cronograph.MongoDb" Version="1.0.70" />
paket add Cronograph.MongoDb --version 1.0.70
#r "nuget: Cronograph.MongoDb, 1.0.70"
// Install Cronograph.MongoDb as a Cake Addin #addin nuget:?package=Cronograph.MongoDb&version=1.0.70 // Install Cronograph.MongoDb as a Cake Tool #tool nuget:?package=Cronograph.MongoDb&version=1.0.70
Cronograph - Simple Cronjob runner
Overview
Simple Cronjob runner created as a HangFire replacement for the times where you just need an inprocess job execution engine. Hangfire can be found here. Cronograph is easily testable and integrates well into Microsoft.Extensions.DependencyInjection.
Install the Cronograph nuget package using the following command in the package manager console window
PM> Install-Package Cronograph
The Nuget package can be found here
Features
The following features are found in Cronograph:
- Single process job execution
- Recurring jobs based on Cron schedules
- Fire-and-forget jobs
- Delayed run-once jobs
The following features are NOT found in Cronograph:
- Scaling out on multiple physical processes and servers
- Job Continuations
- Groups/batches of jobs
- Automatic retries
Usage
In order just to get the simplest cron job up and running in a minimal ASP.NET Core API. Do the following:
using Cronograph;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddCronograph(builder.Configuration);
var app = builder.Build();
var cronograph = app.Services.GetRequiredService<ICronograph>();
cronograph.AddJob("Test job", (cancellationToken) => { Console.WriteLine("Boom!"); return Task.CompletedTask; }, "*/10 * * * * *");
app.Run();
Cronograph also supports cron job classes using the interface IScheduledService. This can be acheived in the following way:
using Cronograph;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddCronograph(builder.Configuration);
var app = builder.Build();
var cronograph = app.Services.GetRequiredService<ICronograph>();
cronograph.AddScheduledService<MyService>("Test service", "*/10 * * * * *");
app.Run();
And with the following scheduled service:
public class MyService : IScheduledService
{
public Task ExecuteAsync(CancellationToken stoppingToken)
{
Console.WriteLine("Scheduled service boom!");
return Task.CompletedTask;
}
}
UserInterface
Crongraph has a simple user interface to visualize the jobs currently registred on the system. Add the following NuGET package:
PM> Install-Package Cronograph.UI
And then add the following line of code to your program.cs:
using Cronograph.UI;
var app = builder.Build();
// Add this..
app.UseCronographUI();
app.Run();
And you should be able to see the user interface on https://YourFantasticMachineAnd:port/Cronograph
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Cronograph.Shared (>= 1.0.70)
- Microsoft.Extensions.Options (>= 8.0.2)
- MongoDB.Bson (>= 2.25.0)
- MongoDB.Driver (>= 2.25.0)
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 |
---|---|---|
1.0.70 | 106 | 7/16/2024 |
1.0.69 | 112 | 5/29/2024 |
1.0.68 | 110 | 5/29/2024 |
1.0.67 | 106 | 5/29/2024 |
1.0.66 | 111 | 5/28/2024 |
1.0.64 | 113 | 5/26/2024 |
1.0.63 | 106 | 5/26/2024 |
1.0.62 | 105 | 5/26/2024 |
1.0.61 | 113 | 5/26/2024 |
1.0.60 | 113 | 5/26/2024 |
1.0.59 | 108 | 5/26/2024 |
1.0.58 | 113 | 5/26/2024 |
1.0.57 | 125 | 5/25/2024 |
1.0.55 | 119 | 5/24/2024 |
1.0.54 | 114 | 5/23/2024 |
1.0.51 | 110 | 5/23/2024 |
1.0.49 | 120 | 5/6/2024 |
1.0.46 | 102 | 4/26/2024 |