Claudalisk.Jobs.PostgreSql 0.1.0-alpha.5

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

Claudalisk.Jobs.PostgreSql

The PostgreSQL transport for Claudalisk.Jobs: one jobs table in each jobs module's schema.

Setup

services.AddClaudaliskPersistence(connectionString);
services.AddClaudaliskJobs();
services.AddClaudaliskPostgreSqlJobs();

AddClaudaliskPostgreSqlJobs registers the transport as a singleton and the writer as a scoped service. It needs AddClaudaliskPersistence.

  • The writer uses the scope's connection, so a job row is inserted in the unit of work that queues it. If the unit of work rolls back, the job is never queued. It also sends a NOTIFY on the module's channel.
  • The transport claims jobs with FOR UPDATE SKIP LOCKED, so workers do not take the same row. An idle worker waits with LISTEN on the module's channel.

The table

An app creates the table from a migration:

migrationBuilder.Sql(JobsTable.CreateSql("ordering"));

The schema must be a lower-case identifier (letters, digits and underscores, not starting with a digit), or the helpers throw ArgumentException. CreateSql never changes. Later changes are separate helpers, each with a drop counterpart:

  • CreatePruneIndexSql / DropPruneIndexSql
  • CreateRunningIndexSql / DropRunningIndexSql: add it in every module schema, because the stale sweep searches running rows for old heartbeats
  • CreateClaimIndexSql / DropClaimIndexSql: replaces the claim index with a partial one that matches the claim order
  • CreateDedupeIndexSql / DropDedupeIndexSql
  • RenameColumnsSql / RestoreColumnsSql: renames six columns so they carry the mark of their type

DropDedupeIndexSql does not restore the queued duplicates that CreateDedupeIndexSql canceled.

Column names

From 0.1.0-alpha.5 the transport reads and writes these names, so every jobs table needs RenameColumnsSql before the app runs on that version:

CreateSql creates RenameColumnsSql renames it to
not_before not_before_timestamp
created_at created_timestamp
started_at started_timestamp
heartbeat_at heartbeat_timestamp
finished_at finished_timestamp
cancel_requested is_cancel_requested

An app adds one migration for each schema that has a jobs table:

protected override void Up(MigrationBuilder migrationBuilder) => migrationBuilder.Sql(JobsTable.RenameColumnsSql("ordering"));

protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.Sql(JobsTable.RestoreColumnsSql("ordering"));
  • A rename keeps the rows, and PostgreSQL updates the indexes to follow the columns.
  • A new app calls RenameColumnsSql right after CreateSql, in the same migration.
  • The index helpers work on either set of names, so they may come before or after the rename.
  • The names of JobRecord and of the JSON the jobs router returns do not change. The Claudalisk.Jobs README explains delivery, retries, deduplication and lanes.

Limits

  • Delivery is at least once.
  • The package uses PostgreSQL features (advisory locks, LISTEN, SKIP LOCKED, jsonb) and no other database.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Claudalisk.Jobs.PostgreSql:

Package Downloads
Claudalisk.Scheduling

Cron schedules from configuration that queue commands as jobs of the scheduler's own jobs module, once per scheduled time.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-alpha.5 86 11/24/2026
0.1.0-alpha.4 161 11/22/2026
0.1.0-alpha.3 75 11/22/2026
0.1.0-alpha.2 74 11/21/2026
0.1.0-alpha.1 644 11/8/2026