NexJob 5.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NexJob --version 5.2.0
                    
NuGet\Install-Package NexJob -Version 5.2.0
                    
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="NexJob" Version="5.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NexJob" Version="5.2.0" />
                    
Directory.Packages.props
<PackageReference Include="NexJob" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NexJob --version 5.2.0
                    
#r "nuget: NexJob, 5.2.0"
                    
#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.
#:package NexJob@5.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NexJob&version=5.2.0
                    
Install as a Cake Addin
#tool nuget:?package=NexJob&version=5.2.0
                    
Install as a Cake Tool

<div align="center">

<br/>

███╗   ██╗███████╗██╗  ██╗     ██╗ ██████╗ ██████╗
████╗  ██║██╔════╝╚██╗██╔╝     ██║██╔═══██╗██╔══██╗
██╔██╗ ██║█████╗   ╚███╔╝      ██║██║   ██║██████╔╝
██║╚██╗██║██╔══╝   ██╔██╗ ██   ██║██║   ██║██╔══██╗
██║ ╚████║███████╗██╔╝ ██╗╚█████╔╝╚██████╔╝██████╔╝
╚═╝  ╚═══╝╚══════╝╚═╝  ╚═╝ ╚════╝  ╚═════╝ ╚═════╝

Background jobs for .NET. Predictable. Observable. No magic.

NuGet NuGet Downloads Build License: MIT

<br/>

</div>


What is NexJob?

NexJob is a reliable background job processing library for .NET 8. It gives you predictable execution, built-in retries, deadline enforcement, and operational visibility — without the complexity of traditional schedulers.

If you need jobs that must run, fail safely, and leave a trace, NexJob handles it as a first-class concern.


Why not Hangfire?

NexJob was built for developers who want Hangfire-like reliability without the paid storage providers or the hidden complexity.

Feature NexJob Hangfire
Storage providers 5 free (PostgreSQL, SQL Server, Redis, MongoDB, InMemory) Free InMemory only; others require paid license
Deadline enforcement Built-in (deadlineAfter) Plugin required
Dead-letter handling Automatic after exhausted retries Manual
Dispatch latency Near-zero (wake-up channel) Polling-based
Dashboard Built-in, standalone UI Built-in (Pro required for advanced)
OpenTelemetry Built-in traces and metrics Plugin required
Concurrency throttling [Throttle] attribute per resource Queue-level limits
Ecosystem Young library, focused scope Mature ecosystem, many plugins
Package size ~50 KB ~2 MB

NexJob is not a drop-in replacement for Hangfire. If you need calendar-based scheduling, distributed execution across untrusted networks, or enterprise plugin ecosystems, Hangfire is the better choice.


Quick Start

dotnet add package NexJob
// 1. Register NexJob and scan for jobs
builder.Services.AddNexJob();
builder.Services.AddNexJobJobs(typeof(Program).Assembly);
// 2. Define a job
public sealed class SendInvoiceJob : IJob<SendInvoiceInput>
{
    private readonly IEmailService _email;

    public SendInvoiceJob(IEmailService email) => _email = email;

    public async Task ExecuteAsync(SendInvoiceInput input, CancellationToken ct)
        => await _email.SendAsync(input.Email, "Your invoice", ct);
}

public sealed record SendInvoiceInput(string Email);
// 3. Enqueue from anywhere
var scheduler = app.Services.GetRequiredService<IScheduler>();
await scheduler.EnqueueAsync<SendInvoiceJob, SendInvoiceInput>(
    new SendInvoiceInput("customer@example.com"),
    deadlineAfter: TimeSpan.FromMinutes(5));

The job expires if not started within 5 minutes — no silent failures, no zombie jobs.


Core Features

  • IJob / IJob<T> — simple and structured job interfaces
  • Predictable retries — exponential backoff with configurable policies, global + per-job [Retry]
  • Deadline enforcement — jobs expire if not executed in time (deadlineAfter)
  • Dead-letter handlers — automatic fallback when all retries are exhausted
  • Concurrency throttling — [Throttle] attribute for per-resource limits
  • Distributed throttling — UseDistributedThrottle() enforces global cluster-wide rate limits via Redis
  • Job continuations — chain jobs with parent/child relationships
  • Idempotency — DuplicatePolicy controls re-enqueue behavior
  • Recurring jobs — via code or appsettings.json
  • Job filters — IJobExecutionFilter middleware for cross-cutting behaviour
  • Job retention — automatic cleanup of terminal jobs with configurable TTL
  • Read replicas — UseDashboardReadReplica() offloads dashboard queries to read replicas (PostgreSQL, SQL Server)
  • Resilient Outbox — transaction-safe event producers for RabbitMQ and Apache Kafka
  • OpenTelemetry — traces and metrics built-in
  • Built-in dashboard — standalone dark UI, zero configuration

Storage Providers

Provider Package Status
InMemory NexJob (core) Production ready
PostgreSQL NexJob.Postgres Production ready
SQL Server NexJob.SqlServer Production ready
Redis NexJob.Redis Production ready
MongoDB NexJob.MongoDB Production ready

All providers implement IRuntimeSettingsStore — runtime configuration persists across restarts.


Packages

Package NuGet Description
NexJob.Dashboard NuGet Embedded ASP.NET Core dashboard middleware
NexJob.Dashboard.Standalone NuGet Embedded HTTP dashboard server for Worker Services
NexJob.OpenTelemetry NuGet OTel SDK instrumentation
NexJob.Trigger.AzureServiceBus NuGet Azure Service Bus trigger
NexJob.Trigger.AwsSqs NuGet AWS SQS trigger
NexJob.RabbitMQ NuGet RabbitMQ trigger & resilient outbox producer
NexJob.Kafka NuGet Apache Kafka trigger & resilient outbox producer
NexJob.Trigger.GooglePubSub NuGet Google Cloud Pub/Sub trigger
NexJob.Trigger.Salesforce NuGet Salesforce Pub/Sub API trigger (gRPC & Avro)
NexJob.Trigger.SalesforceStreaming NuGet Salesforce Streaming API trigger (CometD & Bayeux)

Dashboard

The dashboard provides a visual timeline of every job's lifecycle — no log reconstruction needed. See failures, retries, expired jobs, and execution timing at a glance.

ASP.NET Core Web App

Install package:

dotnet add package NexJob.Dashboard

Configure in Program.cs:

using NexJob.Dashboard;

var builder = WebApplication.CreateBuilder(args);

// Required: memory cache for dashboard metrics
builder.Services.AddMemoryCache();

// Register NexJob + Storage provider
builder.Services.AddNexJob()
    .UseInMemoryStorage();

var app = builder.Build();

// Mount dashboard at /dashboard
app.UseNexJobDashboard("/dashboard");

app.Run();

Worker Service (Standalone)

For Worker Services or console applications without ASP.NET Core:

dotnet add package NexJob.Dashboard.Standalone

Configure in Program.cs:

using NexJob.Dashboard.Standalone;

builder.Services.AddNexJob()
    .UseInMemoryStorage();

// Starts an embedded HTTP server at http://localhost:5005/dashboard
builder.Services.AddNexJobStandaloneDashboard(options =>
{
    options.Port = 5005;
});

Documentation

Complete documentation is in the wiki. Key pages:


Samples & Reference Architecture

The samples/ directory provides comprehensive, runnable reference architectures for all NexJob capabilities:

Sample Stack / Focus Port Highlights
NexJob.Sample.MinimalApi ASP.NET Core Minimal API 5001 Segregated IDashboardStorage, dead-letter handler, deadline enforcement
NexJob.Sample.WebApi ASP.NET Core Web API 5002 Dual-storage (InMemory / PostgreSQL), REST endpoints, .http file
NexJob.Sample.WorkerService Headless Console Worker 5003 Standalone embedded HTTP dashboard server, graceful shutdown
NexJob.Sample.ConfiguredRecurring Declarative Recurring 5004 Zero-code recurring job registration via appsettings.json with timezones
NexJob.Sample.RabbitMQ Broker Integration 5005 Outbox producer + trigger consumer with 5 trigger guarantees
NexJob.Sample.Kafka Streaming Broker 5006 Partitioned Outbox event publishing + consumer trigger with offset tracking
NexJob.Sample.Storage Enterprise Topology 5007 PostgreSQL primary + read replica (UseDashboardReadReplica), Redis throttle (UseDistributedThrottle), OTel
NexJob.Sample.CloudTriggers Unified Cloud Consumers 5008 AWS SQS, Azure Service Bus, GCP Pub/Sub, Salesforce gRPC & CometD with /simulate/* endpoints

A full local test stack (PostgreSQL 16, Redis 7, RabbitMQ 3.13, and Kafka KRaft) is provided in samples/docker-compose.yml.


Benchmarks

Measured per individual enqueue operation on .NET 8 (BenchmarkDotNet v0.14, RyuJIT AVX2, in-memory storage baseline):

Metric NexJob Hangfire Comparison
Latency (Mean) 13.35 µs 35.95 µs 2.7× faster
Memory (Allocated) 2.10 KB 11.20 KB 81% less memory
GC Gen0 (per 1k ops) 0.06 0.85 14× fewer Gen0 collections
GC Gen1 (per 1k ops) 0.00 0.18 Zero Gen1 collections

NexJob is 2.7× faster, allocates 81% less memory, and produces zero Gen1 garbage collections during enqueue bursts. Hangfire incurs additional CPU and allocation overhead due to runtime LINQ expression tree parsing and reflection.

Benchmarks can be parameterized by payload size (PayloadBytes: 0, 1024, 10240) and concurrency levels (ConcurrencyLevel: 10, 50) in benchmarks/NexJob.Benchmarks.


Roadmap

v0.4.0  ✅ Deadlines, dead-letter handlers, wake-up signaling
v0.5.0  ✅ Wake-up channel, recurring jobs, dashboard timeline
v0.6.0  ✅ Distributed reliability tests, recurring config redesign
v0.7.0  ✅ DuplicatePolicy, atomic commits, AI execution system
v0.8.0  ✅ Filters, persistent settings, job retention, wiki
v1.0.0  ✅ API freeze, production hardened
v2.0.0  ✅ External triggers, OpenTelemetry, metrics cache
v3.0.0  ✅ Storage segregation (IJobStorage / IRecurringStorage / IDashboardStorage),
           JobExecutor pipeline, IJobExecutionFilter, IJobControlService,
           UseDashboardReadReplica(), UseDistributedThrottle()
v4.0.0  ✅ Reliability hardening, crash recovery, orphaned job watcher, fault injection
v5.0.0  ✅ Resilient Outbox producers & triggers for RabbitMQ and Apache Kafka
v5.1.0  ✅ Salesforce triggers (gRPC Pub/Sub API + CometD Bayeux Streaming API)
v5.2.0  ✅ Dead-letter retention & chunked purging, consumer-driven triggers, OTel HPA gauges

<div align="center"> <br/>

Built with obsession over developer experience and production reliability.

<br/>

License: MIT    © 2025 Luciano Azevedo

</div>

Product 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 was computed.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (16)

Showing the top 5 NuGet packages that depend on NexJob:

Package Downloads
NexJob.Dashboard

Blazor SSR dashboard middleware for NexJob — real-time monitoring of background jobs.

NexJob.MongoDB

MongoDB storage provider for NexJob — the open-source background job scheduler for .NET 8+.

NexJob.Postgres

PostgreSQL storage provider for NexJob — the open-source background job scheduler for .NET 8+.

NexJob.SqlServer

SQL Server storage provider for NexJob.

NexJob.Redis

Redis storage provider for NexJob.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.7.0 87 10/1/2026
5.6.2 105 10/1/2026
5.6.1 149 9/30/2026
5.6.0 135 9/30/2026
5.5.0 293 9/25/2026
5.4.1 280 9/24/2026
5.4.0 284 9/24/2026
5.3.0 293 9/21/2026
5.2.0 299 9/20/2026
5.1.0 303 9/17/2026
5.0.0 293 9/17/2026
4.0.1 273 9/17/2026
4.0.0 342 4/21/2026
3.0.0 327 4/16/2026
2.0.0 225 4/14/2026
1.0.0 210 4/8/2026
0.8.0 203 4/8/2026
0.7.0 206 4/7/2026
0.6.0 211 4/3/2026
0.0.0-alpha.0 114 9/17/2026
Loading failed