mvdmio.ASP.Jobs
4.1.2
dotnet add package mvdmio.ASP.Jobs --version 4.1.2
NuGet\Install-Package mvdmio.ASP.Jobs -Version 4.1.2
<PackageReference Include="mvdmio.ASP.Jobs" Version="4.1.2" />
<PackageVersion Include="mvdmio.ASP.Jobs" Version="4.1.2" />
<PackageReference Include="mvdmio.ASP.Jobs" />
paket add mvdmio.ASP.Jobs --version 4.1.2
#r "nuget: mvdmio.ASP.Jobs, 4.1.2"
#:package mvdmio.ASP.Jobs@4.1.2
#addin nuget:?package=mvdmio.ASP.Jobs&version=4.1.2
#tool nuget:?package=mvdmio.ASP.Jobs&version=4.1.2
mvdmio.ASP.Jobs
A library for scheduling jobs in ASP.NET Core applications.
Usage
- Add the NuGet package to your project:
dotnet add package mvdmio.ASP.Jobs
- Register the job scheduler and job runner in your
Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
services.AddJobs();
-- OR --
services.AddJobScheduler();
services.AddJobRunner();
}
- Create a job by implementing the
Jobabstract class:
public class MyJobParameters
{
public string Parameter { get; set; }
}
public class MyJob : Job<MyJobParameters>
{
public async Task ExecuteAsync(MyJobParameters parameters, CancellationToken cancellationToken)
{
// Your job logic here
}
}
- Register the job in your DI container:
public void ConfigureServices(IServiceCollection services)
{
services.RegisterJob<MyJob>();
}
- Schedule the job in your application:
public void MyController : Controller
{
private readonly IJobScheduler _jobScheduler;
public MyController(IJobScheduler jobScheduler)
{
_jobScheduler = jobScheduler;
}
public async Task<IActionResult> ScheduleJob()
{
await _jobScheduler.PerformNowAsync<MyJob, MyJobParameters>(new MyJobParameters()); // Runs the job immediately and waits for completion.
await _jobScheduler.PerformAsapAsync<MyJob, MyJobParameters>(new MyJobParameters()); // Runs the job on a separate thread as soon as a slot becomes available.
await _jobScheduler.PerformAtAsync<MyJob, MyJobParameters>(DateTime.Now, new MyJobParameters()); // Runs the job on a separate thread at the given time.
return Ok();
}
}
Scheduled jobs (CRON)
You can schedule any job to run repeatedly using CRON expressions.
This library uses the Cronos nuget package to parse CRON expressions.
To schedule a job to run repeatedly, use the PerformCronAsync method on the IJobScheduler interface. Usually this is
done during application startup.
var jobScheduler = application.Services.GetRequiredService<IJobScheduler>();
jobScheduler.PerformCronAsync<MyJob>("* * * * * *", new MyJobParameters()); // Run every second
jobScheduler.PerformCronAsync<MyJob>("* * * * *", new MyJobParameters()); // Run every minute
jobScheduler.PerformCronAsync<MyJob>("*/5 * * * *", new MyJobParameters()); // Run every 5 minutes
jobScheduler.PerformCronAsync<MyJob>("0 * * * *", new MyJobParameters()); // Run once an hour at the beginning of the hour
jobScheduler.PerformCronAsync<MyJob>("0 0 * * *", new MyJobParameters()); // Run once a day at midnight
jobScheduler.PerformCronAsync<MyJob>("0 0 * * 0", new MyJobParameters()); // Run once a week at midnight on Sunday morning
jobScheduler.PerformCronAsync<MyJob>("0 0 1 * *", new MyJobParameters()); // Run once a month at midnight of the first day of the month
.NET Framework
It is possible to use this library in .NET Framework applications. However, since those applications don't generally use
Dependency Injection you can use the static Jobs class for registering jobs, scheduling jobs, and starting the job
runner process.
// In your application startup code
Jobs.Register<MyJob>(); // All jobs must be registered before starting the job runner
Jobs.Start();
// In you application shutdown code
Jobs.Stop();
// In your application code
Jobs.Scheduler.PerformNow<MyJob, MyJobParameters>(new MyJobParameters());
Jobs.Scheduler.PerformAsap<MyJob, MyJobParameters>(new MyJobParameters());
Jobs.Scheduler.PerformAt<MyJob, MyJobParameters>(DateTime.Now, new MyJobParameters());
| 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. net9.0 is compatible. 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 is compatible. 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. |
-
net10.0
- Cronos (>= 0.12.0)
- JetBrains.Annotations (>= 2025.2.4)
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.7)
- Microsoft.Extensions.DependencyInjection (>= 10.0.7)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.7)
- mvdmio.Database.PgSQL (>= 0.25.0)
- OpenTelemetry.Api (>= 1.15.3)
- Serilog (>= 4.3.1)
-
net8.0
- Cronos (>= 0.12.0)
- JetBrains.Annotations (>= 2025.2.4)
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.7)
- Microsoft.Extensions.DependencyInjection (>= 10.0.7)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.7)
- mvdmio.Database.PgSQL (>= 0.25.0)
- OpenTelemetry.Api (>= 1.15.3)
- Serilog (>= 4.3.1)
-
net9.0
- Cronos (>= 0.12.0)
- JetBrains.Annotations (>= 2025.2.4)
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.7)
- Microsoft.Extensions.DependencyInjection (>= 10.0.7)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.7)
- mvdmio.Database.PgSQL (>= 0.25.0)
- OpenTelemetry.Api (>= 1.15.3)
- Serilog (>= 4.3.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on mvdmio.ASP.Jobs:
| Package | Downloads |
|---|---|
|
mvdmio.HealthCheck.Client
Client library for mvdm.io HealthCheck. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.1.2 | 46 | 5/3/2026 |
| 4.1.1 | 49 | 5/2/2026 |
| 4.1.0 | 147 | 4/25/2026 |
| 4.0.7 | 84 | 4/25/2026 |
| 4.0.6 | 680 | 2/27/2026 |
| 4.0.5 | 165 | 2/18/2026 |
| 4.0.4 | 125 | 2/16/2026 |
| 4.0.3 | 348 | 2/5/2026 |
| 4.0.2 | 136 | 2/4/2026 |
| 4.0.1 | 109 | 2/4/2026 |
| 4.0.0 | 122 | 2/3/2026 |
| 4.0.0-beta.1 | 60 | 2/3/2026 |
| 3.9.1 | 186 | 1/23/2026 |
| 3.9.0 | 95 | 1/23/2026 |
| 3.8.2 | 108 | 1/21/2026 |
| 3.8.1 | 120 | 1/20/2026 |
| 3.8.0 | 106 | 1/18/2026 |
| 3.7.0 | 98 | 1/17/2026 |
| 3.6.3 | 120 | 1/17/2026 |
| 3.6.2 | 401 | 10/14/2025 |