Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

IDDQueue

Documentation · Step-by-step setup

A PostgreSQL broker and Results backend for Dramatiq, built on synchronous Psycopg 3. Tasks, results and coordination live in PostgreSQL; no Redis or ORM is required by IDDQueue.

Current release: 0.13.0rc3 — a release candidate for evaluation. GitHub assets include the wheel, sdist and SHA256 checksums.

IDDQueue is a fork of DALIBO's dramatiq-pg (original package). It preserves the PostgreSQL license and original contributor credits.

What it provides

  • Durable JSONB task/results storage, delayed tasks and crash recovery.
  • Transactional publication alongside business writes; atomic batches and deduplication.
  • PostgreSQL rate limiters, barriers and Dramatiq group callbacks.
  • Pause/resume, cooperative cancellation, failed-task inspection/retry and attempt history.
  • Fixed-interval scheduling and optional Prometheus queue metrics.
  • Schema/prefix isolation and a tested FastAPI example.

Delivery is at least once: actors and callbacks must be idempotent. LISTEN/NOTIFY carries message IDs as wakeup hints; consumers claim authoritative SQL rows with session advisory locks. See behavior and limits.

Install

Requires Python 3.10+, Dramatiq 2.2.1+ and Psycopg 3.3.6+. CI tests Python 3.10 / 3.13 / 3.14 with PostgreSQL 14 / 18. See compatibility and API stability.

uv venv
uv pip install "iddqueue[binary]==0.13.0rc3"

The binary extra supplies libpq. Base installs require system libpq; [binary,monitoring] also enables Prometheus support.

Migrating from dramatiq-pg? Follow the migration guide before changing imports, pools or database storage. Stop all participants, back up data, run the upgrade and restart consistently. Fresh initialization and an existing-storage upgrade are different operations.

Quickstart

Configure PostgreSQL using PGHOST, PGPORT, PGUSER, PGDATABASE and your normal credential mechanism. Initialize fresh storage:

uv run --no-sync iddqueue init

For existing storage, use iddqueue upgrade after following the migration guide. Both commands manage the complete feature schema.

Save as tasks.py:

import dramatiq
from iddqueue import PostgresBroker

broker = PostgresBroker()
dramatiq.set_broker(broker)

@dramatiq.actor(broker=broker, store_results=True)
def add(left: int, right: int):
    return left + right

Start a separate worker from the same directory/environment:

uv run --no-sync dramatiq --use-spawn --processes=1 --threads=1 tasks

In another terminal, publish and read the result:

uv run --no-sync python - <<'PY'
from tasks import add, broker

try:
    message = add.send(2, 3)
    print(message.message_id)
    print(message.get_result(backend=broker.backend, block=True, timeout=10000))
finally:
    broker.close()
PY

The result is 5; timeouts are milliseconds. Each process creates its own pool. Close broker-owned pools on shutdown; callers close pools they supply.

Guides and examples

Domain actors and one worker bootstrap are included since RC3.

The broker and result APIs are synchronous. Async actors use Dramatiq's AsyncIO middleware; FastAPI async endpoints offload publication to a thread. Transactional enqueue does not accept a Psycopg AsyncConnection.

Session-bound locks/listeners require persistent database sessions; PgBouncer transaction pooling is unsuitable. Namespace separation is not access control. The legacy django-dramatiq-pg integration has been archived since September 3, 2024; IDDQueue compatibility is unverified. No tested Django integration is currently provided.

Compared with dramatiq-pg

Baseline: dramatiq-pg 0.12.0, compared with the published IDDQueue 0.13.0rc3 prerelease. This describes the published version, not every future upstream revision. Both projects provide a PostgreSQL Dramatiq broker.

Area dramatiq-pg 0.12.0 IDDQueue 0.13.0rc3 / practical benefit
Core storage and delivery JSONB tasks/results, delayed tasks, LISTEN/NOTIFY, advisory locks, recovery and maintenance CLI Preserved; at-least-once delivery still requires idempotent actors
Actor initialization Broker configured before actor imports Opt-in Domain declarations import before DSN; explicit startup registration and domain queues
Runtime Python >=3.6,<4; Dramatiq >=1.5,<2; Psycopg 2 Python >=3.10,<4; Dramatiq >=2.2.1,<3; synchronous Psycopg 3 and psycopg-pool
Pool lifecycle Psycopg 2 pools Lazy owned pools, explicit close, caller-owned pool support
Transactional publication Regular enqueue Caller-owned transaction API: commit business data and tasks together
Coordination No PostgreSQL rate-limit/barrier backend PostgreSQL rate limits, durable barriers and standard GroupCallbacks without Redis
Task operations stats, purge, recover, flush Failed-task inspection/targeted retry, pause/resume, cooperative cancellation and opt-in attempt history
Publication controls Single-message enqueue Deduplication keys/TTL and atomic batches of up to 1000; deduplication is not exactly-once execution
Scheduling Per-message delay Also a multi-process fixed-interval scheduler; no cron/calendar expressions
Observability Basic CLI statistics Ready/scheduled backlog, task age and optional Prometheus collector
Storage namespaces Configurable schema/table prefix; shared channel/lock domains Instance-specific queries and schema/prefix-specific channels/locks; storage separation is not access control
Dramatiq integration Broker/results implementation Verified pipelines, groups, AsyncIO and standard middleware; these are Dramatiq features, not a replacement orchestration engine
Compatibility evidence Historical upstream tests CI on Python 3.10/3.13/3.14 × PostgreSQL 14/18, functional tests and installed-wheel checks

See migration from dramatiq-pg for dependency, pool, import, CLI and database changes, including backup and rollback. No throughput advantage is claimed here. The 0.13.0rc3 prerelease is available on PyPI; the legacy Django integration is archived and has not been verified with IDDQueue.

Development and support

Use CONTRIBUTING for locked uv setup and the full release gate. Functional tests require a dedicated PostgreSQL instance: they terminate sessions and crash/restart workers. Project planning and evidence live in OpenSpec. Report reproducible issues on GitHub.

License and credits

Released under the PostgreSQL license, preserving Copyright (c) 2019, DALIBO and the original author Étienne BERSAC.

Thanks to upstream contributors Andy Freeland, Curtis Maloney (Django support), Federico Caselli, Giuseppe Papallo and Rafal Kwasny. The historical upstream logo was created by Damien CAZEILS. Original changelog remains available as historical context.

Metadata

Release files for iddqueue 0.13.0rc3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iddqueue 0.13.0rc3
File Size Uploaded
iddqueue-0.13.0rc3.tar.gz 26.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iddqueue 0.13.0rc3
File Interpreter ABI Platform
iddqueue-0.13.0rc3-py3-none-any.whl Python 3 none any Details

Total release size: 60.7 kB

Release files / iddqueue-0.13.0rc3.tar.gz

Download URL iddqueue-0.13.0rc3.tar.gz
Size 26.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3bcad9cc15030b3baedc40ef0bcf109d79d3a781f88a5f650f7d9129a540013a
BLAKE2b-256 checksum
How to use checksums
d223ae82846238e24f8829b317db630c19096b6aec906769c27f514399d0bd27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / iddqueue-0.13.0rc3-py3-none-any.whl

Download URL iddqueue-0.13.0rc3-py3-none-any.whl
Size 34.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25e56080f3871e9fa0553be67b3b21d4ace8b363abe42feab45f8f1363520bf9
BLAKE2b-256 checksum
How to use checksums
ca29c6ed73de4599cf7f016734fbbf799b4506e4f5dff742b4d862ea0e40e359
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page