A simple way to create a background timer job for ASP.NET Core that runs delegate jobs on a configurable interval.
$ dotnet add package BackgroundTimerJobA simple and flexible timer job background service for ASP.NET Core. This package provides a way to create background service that runs a delegate on a configurable interval. It uses dependency injection to resolve parameters and supports a configurable timeout per job execution.
AddTimerJob extension method to register your timer job.Install the package via NuGet:
dotnet add package BackgroundTimerJobs
// Example: a timer job that runs every 5 minutes.
builder.Services.AddTimerJob(
TimeSpan.FromMinutes(5),
async (IMediator mediator, IMyDbContext dbContext, CancellationToken cancellationToken) =>
{
await mediator.Send(new MyBackgroundJobRequest(), cancellationToken);
// Additional job logic...
});