feat(queue-postgres): add a PostgreSQL queue adapter #53

Merged
crapougnax merged 1 commit from feat/queue-postgres into develop 2026-11-15 18:46:22 +00:00
Member

Summary

New package @quatrain/queue-postgres: durable tasks stored in a table, without a broker.

  • Tasks are claimed with FOR UPDATE SKIP LOCKED: several workers can listen on one topic without processing a task twice concurrently.
  • Per-listener concurrency, oldest task first, progress and attempts.
  • retryTask for failed tasks, requeueStale for tasks abandoned by a stopped worker. Delivery is at least once: handlers must be idempotent.
  • Listeners and close() wait for the tasks being processed.
  • The schema ships as an idempotent DDL file (sql/queue_messages.sql); ensureSchema: false leaves it to the application's migrations.

Checks

Integration tests need a database (QUEUE_POSTGRES_TEST_URL) and are skipped without one, so the CI of this pull request does not run them unless that variable is set. They ran locally before the rebase onto the current develop.

Closes #52

🤖 Generated with Claude Code

## Summary New package `@quatrain/queue-postgres`: durable tasks stored in a table, without a broker. - Tasks are claimed with `FOR UPDATE SKIP LOCKED`: several workers can listen on one topic without processing a task twice concurrently. - Per-listener concurrency, oldest task first, progress and attempts. - `retryTask` for failed tasks, `requeueStale` for tasks abandoned by a stopped worker. Delivery is at least once: handlers must be idempotent. - Listeners and `close()` wait for the tasks being processed. - The schema ships as an idempotent DDL file (`sql/queue_messages.sql`); `ensureSchema: false` leaves it to the application's migrations. ## Checks Integration tests need a database (`QUEUE_POSTGRES_TEST_URL`) and are skipped without one, so the CI of this pull request does not run them unless that variable is set. They ran locally before the rebase onto the current `develop`. Closes #52 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(queue-postgres): add a PostgreSQL queue adapter
All checks were successful
Quatrain Core CI / Monorepo Build, Tests & Quality Audit (push) Successful in 8m20s
Quatrain Core CI / Publish Changed Packages to npm (push) Has been skipped
Quatrain Core CI / Monorepo Build, Tests & Quality Audit (pull_request) Successful in 9m19s
Quatrain Core CI / Publish Changed Packages to npm (pull_request) Has been skipped
dafd510e2b
New package @quatrain/queue-postgres: durable tasks stored in a table,
without a broker.

- tasks are claimed with FOR UPDATE SKIP LOCKED, so several workers can
  listen on one topic without processing a task twice concurrently;
- per-listener concurrency, oldest task first, progress and attempts;
- retryTask for failed tasks, requeueStale for tasks abandoned by a
  stopped worker (at-least-once delivery);
- listeners and close() wait for the tasks being processed.

The schema ships as an idempotent DDL file. Integration tests need a
database (QUEUE_POSTGRES_TEST_URL) and are skipped without one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
crapougnax merged commit 7c2515c9bb into develop 2026-11-15 18:46:22 +00:00
crapougnax deleted branch feat/queue-postgres 2026-11-15 18:46:23 +00:00
Sign in to join this conversation.
No description provided.