Skip to content

NexJob

Predictable and observable background job processing for .NET 8.

NexJob gives you predictable execution, built-in retries, deadline enforcement, and operational visibility — without the complexity of traditional schedulers. If a job must run, fail safely, and leave a trace, NexJob handles it as a first-class concern.


Quick Start

dotnet add package NexJob
// Program.cs — register NexJob and scan for jobs
builder.Services.AddNexJob()
               .AddNexJobJobs(typeof(Program).Assembly);
// Define a job
public sealed class HelloJob : IJob
{
    public Task ExecuteAsync(CancellationToken ct)
    {
        Console.WriteLine("Hello from NexJob!");
        return Task.CompletedTask;
    }
}
// Enqueue from anywhere
var scheduler = app.Services.GetRequiredService<IScheduler>();
await scheduler.EnqueueAsync<HelloJob>();

See Getting Started for a complete walkthrough.


When Should I Use NexJob?

NexJob is a good fit when you need:

  • Predictable execution — retries, deadlines, and failure handling built into the model
  • Deadline enforcement — jobs expire if not executed in time (deadlineAfter)
  • Dead-letter handling — automatic fallback when all retries are exhausted
  • Operational visibility — built-in dashboard, traces, and metrics
  • Low-latency dispatch — wake-up channel for near-zero latency local enqueue
  • Free storage providers — PostgreSQL, SQL Server, Redis, MongoDB, InMemory
  • Event-driven triggers — enqueue jobs from Azure Service Bus, SQS, RabbitMQ, Kafka, Google Pub/Sub, Salesforce Pub/Sub API, or Salesforce Streaming (CometD)

NexJob vs Alternatives

Feature NexJob Hangfire Quartz.NET
Execution model Stateless dispatcher, atomic commits Polling-based Trigger-based
Retry & dead-letter Built-in, configurable Plugin required Manual
Deadline enforcement Built-in (deadlineAfter) Plugin required Manual
Scheduling Delay, one-shot and cron recurring; dispatched by polling with a local wake-up Polling Cron + calendar
Dashboard Built-in, standalone Paid None
OpenTelemetry Built-in Plugin required Plugin required

When NOT to use NexJob:

  • You need distributed job execution across untrusted networks
  • You require sub-second scheduling precision (NexJob polls at configurable intervals)
  • You need a full-featured enterprise scheduler with calendar-based triggers

Core Features

Job Model

  • IJob / IJob<T> — simple and structured execution
  • Recurring jobs — via code or appsettings.json
  • Continuations — chain jobs with parent/child relationships
  • External Triggers — enqueue jobs from message brokers automatically

Reliability

  • Retry policies — a global delay policy plus per-job [Retry] with configurable exponential backoff
  • deadlineAfter — jobs expire if not executed in time
  • IDeadLetterHandler<T> — automatic fallback on permanent failure
  • Idempotency — DuplicatePolicy controls re-enqueue behavior

Operations

  • OpenTelemetry — traces and metrics built-in
  • Dashboard — standalone UI for monitoring
  • [Throttle] — concurrency limits per resource

Extensibility

  • Job Filters — IJobExecutionFilter middleware pipeline for cross-cutting behaviour

Documentation

Start here

Page Purpose
Mental Model ⭐ How NexJob works — read this first
Getting Started Run your first job in 2 minutes
Job Types IJob vs IJob<T>, dead-letter handlers

Build & schedule

Page Purpose
Scheduling Enqueue, schedule, priority, deadline
Recurring Jobs Cron-based recurring execution
Continuations Chain jobs together
Job Filters Cross-cutting middleware for job execution
External Triggers Enqueue jobs from message brokers (AWS SQS, Azure Service Bus, GCP Pub/Sub, Salesforce Pub/Sub API and Streaming)
Kafka Integration Kafka Triggers & Resilient Outbox Producer
RabbitMQ Integration RabbitMQ Triggers & Resilient Outbox Producer

Operate in production

Page Purpose
Retry & Dead Letter Retry policies and fallback handlers
Throttling Concurrency limits per resource (local & distributed via Redis)
IJobContext Access runtime context inside jobs
Storage Providers PostgreSQL, SQL Server, Redis, MongoDB, InMemory
Dashboard Maxton modern UI, 5 themes, Cluster Topology, SSE live logs, Listeners
Configuration Reference All options and settings
OpenTelemetry Traces and metrics
Best Practices Production guidelines
Writing Tests Testing patterns

Reference

Page Purpose
Common Scenarios ⭐ Real-world use cases with code
Troubleshooting ⭐ Debug common issues
Idempotency ⭐ Prevent duplicate execution
Migration Breaking changes and upgrade guide
FAQ ⭐ Basic and tricky questions, each answer checked against the source

Next Steps


v5.6.1 · Changelog · GitHub