#postgresql #orchestration #durable-execution #workflow #workflow-orchestration #duroxide

duroxide-pg

A PostgreSQL-based provider implementation for Duroxide, a durable task orchestration framework

19 releases

new 0.1.20 Feb 17, 2026
0.1.19 Feb 8, 2026
0.1.17 Jan 31, 2026
0.1.9 Dec 28, 2025
0.1.0 Nov 30, 2025

#974 in Database interfaces

MIT license

300KB
6K SLoC

SQL 4K SLoC // 0.1% comments Rust 2K SLoC // 0.0% comments

Duroxide PostgreSQL Provider

A PostgreSQL-based provider implementation for Duroxide, a durable task orchestration framework for Rust.

Note: See CHANGELOG.md for version history and breaking changes.

Installation

Add to your Cargo.toml:

[dependencies]
duroxide-pg = "0.1"

Usage

use duroxide_pg::PostgresProvider;
use duroxide::Worker;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Create a provider with the database URL
    let provider = PostgresProvider::new("postgres://user:password@localhost:5432/mydb").await?;

    // Use with a Duroxide worker
    let worker = Worker::new(provider);
    // ... register orchestrations and activities, then run
    
    Ok(())
}

Custom Schema

To isolate data in a specific PostgreSQL schema:

let provider = PostgresProvider::new_with_schema(
    "postgres://user:password@localhost:5432/mydb",
    Some("my_schema"),
).await?;

Configuration

Environment Variable Description Default
DUROXIDE_PG_POOL_MAX Maximum connection pool size 10

Features

  • Automatic schema migration on startup
  • Connection pooling via sqlx
  • Custom schema support for multi-tenant isolation
  • Full implementation of the Duroxide Provider and ProviderAdmin traits
  • Poison message detection with attempt count tracking
  • Lock renewal for long-running orchestrations and activities

Latest Release (0.1.20)

  • Updated to duroxide 0.1.18 with Activity Session Affinity support
  • New migration 0014_add_session_support.sql — sessions table, session routing in fetch/ack
  • renew_session_lock() and cleanup_orphaned_sessions() provider methods
  • 24 session e2e tests, 33 session validation tests
  • See CHANGELOG.md for full version history

License

MIT License - see LICENSE for details.

Dependencies

~46–64MB
~1M SLoC