NexJob.Postgres 5.7.0

dotnet add package NexJob.Postgres --version 5.7.0
                    
NuGet\Install-Package NexJob.Postgres -Version 5.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.Postgres" Version="5.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NexJob.Postgres" Version="5.7.0" />
                    
Directory.Packages.props
<PackageReference Include="NexJob.Postgres" />
                    
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.Postgres --version 5.7.0
                    
#r "nuget: NexJob.Postgres, 5.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.Postgres@5.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.Postgres&version=5.7.0
                    
Install as a Cake Addin
#tool nuget:?package=NexJob.Postgres&version=5.7.0
                    
Install as a Cake Tool

NexJob.Postgres

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

Backed by Npgsql and Dapper, this provider uses SELECT FOR UPDATE SKIP LOCKED for atomic, concurrency-safe job fetching across multiple distributed worker nodes.


Installation

dotnet add package NexJob.Postgres

Quick Start

Register PostgreSQL storage in your dependency injection container before calling AddNexJob():

using NexJob;
using NexJob.Postgres;

var builder = WebApplication.CreateBuilder(args);

// 1. Register PostgreSQL storage
builder.Services.AddNexJobPostgres(
    builder.Configuration.GetConnectionString("NexJobConnection")!);

// 2. Register NexJob core services
builder.Services.AddNexJob(options =>
{
    options.Workers = 10;
    options.Queues = ["default", "critical"];
});

Features

  • Atomic Job Dispatching: Leverages PostgreSQL FOR UPDATE SKIP LOCKED to ensure zero lock contention and no double-execution across multiple server instances.
  • High-Throughput Batch Processing: Dynamic batch dequeue (FetchBatchAsync) and vectorized batch acknowledgment (AcknowledgeBatchAsync) with native array operations (WHERE id = ANY(@Ids)).
  • Automatic Schema Migration: Applies database migrations automatically on startup using PostgreSQL advisory locks (pg_advisory_lock), ensuring safe concurrent migrations in multi-node clusters.
  • Idempotency Enforcement: Supports strict and conditional deduplication policies (DuplicatePolicy) indexed on idempotency_key.
  • Runtime Settings Store: Persists dynamic queue throttling and runtime configuration in nexjob_settings.
  • Dashboard Read Replica Support: Offload read-heavy dashboard and telemetry queries to a secondary database replica.

High-Throughput Batch Processing

For heavy ingestion workloads, enable batch processing to eliminate per-job WAL transaction log flushes:

builder.Services.AddNexJobPostgres(connectionString);

builder.Services.AddNexJob(options =>
{
    // Workers dynamically batch fetches to keep all idle slots busy (LIMIT availableWorkers)
    options.Workers = 30;
    options.PollingInterval = TimeSpan.FromMilliseconds(20);

    // Commit successful jobs in asynchronous batches via WHERE id = ANY(@Ids)
    options.EnableBatchAcknowledgment = true;
});

Read Replica Configuration

Reusing an NpgsqlDataSource

If your application already has an NpgsqlDataSource (for example one shared with EF Core or configured with custom type mappings), pass it instead of a connection string:

builder.Services.AddNexJobPostgres(existingDataSource);

If your database topology includes a PostgreSQL read replica, you can isolate dashboard queries from the write path using UseDashboardReadReplica:

builder.Services.AddNexJobPostgres(primaryConnectionString);

builder.Services.AddNexJob(options =>
{
    options.Workers = 10;
})
.UseDashboardReadReplica(readReplicaConnectionString);

Database Tables

The provider automatically manages the following tables:

Table Purpose
nexjob_jobs Job records, payloads, state transitions, attempts, and error logs
nexjob_recurring Recurring cron schedules and execution state
nexjob_heartbeats Active worker node registration and health checks
nexjob_settings Dynamic runtime configurations and queue pause flags

Connection String Example

{
  "ConnectionStrings": {
    "NexJobConnection": "Host=localhost;Port=5432;Database=nexjob;Username=postgres;Password=postgres;Include Error Detail=true"
  }
}

Connection pool

NexJob shares your database with other applications. A node needs about Workers + 5 connections, so set Maximum Pool Size in the connection string to about Workers + 10 and multiply by the number of nodes. NexJob logs the pool size it finds at startup and warns when it is smaller than Workers. See Database connections and pool sizing.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.7.0 35 10/1/2026
5.6.2 41 10/1/2026
5.6.1 40 9/30/2026
5.6.0 40 9/30/2026
5.5.0 84 9/25/2026
5.4.1 84 9/24/2026
5.4.0 87 9/24/2026
5.3.0 90 9/21/2026
5.2.0 89 9/20/2026
5.1.0 91 9/17/2026
5.0.0 101 9/17/2026
4.0.1 95 9/17/2026
4.0.0 135 4/21/2026
3.0.0 126 4/16/2026
2.0.0 119 4/14/2026
1.0.0 119 4/8/2026
0.8.0 127 4/8/2026
0.7.0 123 4/7/2026
0.6.0 117 4/3/2026
0.0.0-alpha.0 49 9/17/2026
Loading failed