Skip to content

jamesgober/dotnet-worker-kit

Repository files navigation

dotnet-worker-kit

NuGet Downloads License CI


A background job queue and scheduled task runner for .NET applications. Enqueue work, schedule recurring tasks with cron expressions, and process jobs with retry policies — all built on IHostedService and Channel<T> with zero external dependencies.

Features

  • Job queue — enqueue typed jobs with priority, timeout, and retry configuration
  • Scheduled tasks — cron expressions and interval-based recurring execution
  • Retry policies — fixed, exponential backoff, or custom strategies with dead letter capture
  • Configurable concurrency — N worker threads pulling from a bounded channel
  • Scoped execution — each job gets its own DI scope for clean resource management
  • Job middleware — wrap execution with logging, timing, metrics, or custom concerns
  • Graceful shutdown — in-flight jobs complete before the host stops
  • Zero external dependencies — no Redis, no SQL, just in-process Channel<T>

Installation

dotnet add package JG.WorkerKit

Quick Start

builder.Services.AddWorkerKit(options =>
{
    options.WorkerCount = 2;
    options.DefaultRetryPolicy = RetryPolicy.Exponential(maxRetries: 3);
});

builder.Services.AddJobHandler<SendEmailData, SendEmailHandler>();
builder.Services.AddScheduledTask<CleanupTask>("0 */6 * * *");

Documentation

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

Licensed under the Apache License 2.0. See LICENSE for details.


Ready to get started? Install via NuGet and check out the API reference.

About

Background job runner for .NET 8. Priority queues, cron scheduling, retry with exponential backoff, per-job timeouts, and scoped DI.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages