duroxide-pg-opt

Crates.ioduroxide-pg-opt
lib.rsduroxide-pg-opt
version0.1.7
created_at2025-12-29 14:38:15.768198+00
updated_at2025-12-29 14:38:15.768198+00
descriptionA PostgreSQL-based provider implementation for Duroxide, a durable task orchestration framework
homepage
repositoryhttps://github.com/affandar/duroxide-pg
max_upload_size
id2010695
size284,802
Affan Dar (affandar)

documentation

README

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.5)

  • Updated to duroxide 0.1.3 with poison message handling
  • Added abandon_work_item() and renew_orchestration_item_lock() methods
  • 61 provider validation tests passing
  • See CHANGELOG.md for full version history

License

MIT License - see LICENSE for details.

Commit count: 73

cargo fmt