NexJob 0.7.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NexJob --version 0.7.0
                    
NuGet\Install-Package NexJob -Version 0.7.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="0.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NexJob" Version="0.7.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 0.7.0
                    
#r "nuget: NexJob, 0.7.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@0.7.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=0.7.0
                    
Install as a Cake Addin
#tool nuget:?package=NexJob&version=0.7.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>


NexJob

Background jobs that execute reliably and enforce deadlines. No hidden state. No surprises in production.

Jobs expire if not started in time. Storage is authoritative. State transitions are persisted. This is how background processing should work.


Why NexJob

  • Deadlines are enforced: Jobs expiring before execution are marked Expired and skipped. No silent failures.
  • Storage owns state: All state persisted. Multi-instance safe from day one. Dispatcher is stateless.
  • Predictable execution: No serialization. Jobs run natively with async/await. One job instance per execution.
  • Explicit failure handling: Retries are configured. Dead-letter handlers trigger for permanent failures.
  • Built for visibility: Live timeline, execution history, failure tracking. OpenTelemetry integration.
  • No hidden behavior: What you see is what happens. Clear, deterministic execution model.

Key Features

  • Deadline enforcement — jobs expire if not started in time
  • Dead-letter handlers — handle permanent failures automatically
  • Retry policies — global and per-job control
  • Resource throttling — limit concurrency per resource
  • Live dashboard — execution timeline, history, observability
  • Graceful shutdown — jobs complete naturally; strays are requeued
  • All storage providers free — PostgreSQL, SQL Server, Redis, MongoDB
  • Live config — pause/resume, adjust workers at runtime

Quick Example

Define a job:

public 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, "Invoice attached", ct);
}

Register and enqueue with deadline:

builder.Services.AddNexJob(builder.Configuration)
                .AddNexJobJobs(typeof(Program).Assembly);

var scheduler = app.Services.GetRequiredService<IScheduler>();

// Enqueue with 5-minute deadline. Job expires if not started in time.
await scheduler.EnqueueAsync<SendInvoiceJob, SendInvoiceInput>(
    new(orderId, email),
    deadlineAfter: TimeSpan.FromMinutes(5));

Job executes immediately on an available worker. If it misses the deadline, it's marked Expired and skipped.


Dashboard

Dashboard Timeline

Visual timeline, not logs.

Logs force you to reconstruct what happened. The dashboard shows it directly: every job's exact state and when it transitioned. See failures, retries, expired jobs, and execution timing at a glance.

Live progress reporting for long-running jobs:

public async Task ExecuteAsync(ImportInput input, CancellationToken ct)
{
    await _ctx.ReportProgressAsync(0, "Starting...", ct);
    // ... do work ...
    await _ctx.ReportProgressAsync(100, "Done.", ct);
}

Enable it:

app.UseNexJobDashboard("/dashboard");

One dashboard view. Full system visibility. No investigation required.


Core Concepts

Job Types

  • IJob — jobs with no input
  • IJob<T> — jobs with structured input

Lifecycle

Jobs move through states: EnqueuedProcessingSucceeded (or Failed → retry).

Terminal states: Dead-letter (exhausted retries), Expired (deadline missed).

Deadlines

Set at enqueue. Checked before execution. Expired jobs are marked Expired and skipped:

await scheduler.EnqueueAsync<PaymentJob, PaymentInput>(
    input,
    deadlineAfter: TimeSpan.FromMinutes(5));

Retries

Global policy. Per-job override:

[Retry(5, InitialDelay = "00:00:30", Multiplier = 2.0, MaxDelay = "01:00:00")]
public class PaymentJob : IJob<PaymentInput> { ... }

Dead-Letter Handling

Triggered when retries exhausted. Handler runs in isolated scope:

public class PaymentDeadLetterHandler : IDeadLetterHandler<PaymentJob>
{
    public async Task HandleAsync(JobRecord failedJob, Exception lastException, CancellationToken ct)
        => await _alerts.SendAsync("Payment failed", ct);
}

builder.Services.AddTransient<IDeadLetterHandler<PaymentJob>, PaymentDeadLetterHandler>();

Installation

# Core
dotnet add package NexJob

# Storage (pick one)
dotnet add package NexJob.Postgres
dotnet add package NexJob.SqlServer
dotnet add package NexJob.Redis
dotnet add package NexJob.MongoDB

# Dashboard (optional)
dotnet add package NexJob.Dashboard

Philosophy

Explicit behavior over magic. Jobs execute natively. Storage owns state. Deadlines are enforced. Failures are handled, not hidden. If it's not obvious from the code, it's not in NexJob.


Roadmap

v0.4.0  ✅ Deadlines, dead-letter handlers, wake-up signaling
v1.0.0  ○ Stable API, production hardened, all providers tested
v2.0.0  ○ Distributed coordination, multi-node consistency

<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 (6)

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.Postgres

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

NexJob.MongoDB

MongoDB 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
1.0.0 83 4/8/2026
0.8.0 78 4/8/2026
0.7.0 123 4/7/2026
0.6.0 162 4/3/2026
0.5.2 168 4/1/2026
0.5.1 158 4/1/2026
0.5.0 168 3/31/2026
0.4.0 163 3/31/2026
0.3.2 206 3/28/2026
0.3.1 219 3/28/2026
0.3.0 181 3/27/2026
0.2.0 178 3/27/2026
0.1.1 131 3/27/2026
0.1.0 122 3/26/2026
0.1.0-alpha 123 3/26/2026