Skip to main content

Delivery guarantees

A committed publication stores its payload and the deliveries selected for live subscribed queues atomically. Each queue then tracks its delivery independently. Processing uses claims with visibility timeouts and acknowledgements, so an unfinished delivery can be attempted again.

These guarantees describe queue state in PostgreSQL. They do not make arbitrary application effects exactly once, remove the need for maintenance, or override PostgreSQL's durability configuration.

Publication and fan-out​

A successful standalone SDK publish means its database operation committed. Within a caller-owned transaction, a successful publish call is provisional until the caller commits. Other consumers cannot claim that uncommitted publication.

The live queues selected for a publication receive their delivery rows in the same transaction as the payload. A failure inserting one selected delivery fails that transaction; there is no successful partial fan-out. Create subscriptions and commit their declarations before publishing the events they must receive. Do not rely on a concurrent declaration winning a race with publication.

Queues do not replay history when created. A Durable queue receives publications while its consumers are offline; an expired Exclusive queue does not. A publication can succeed with no subscribed queue. See Publishing messages for these boundaries and unknown commit outcomes.

At-least-once delivery​

A claim reserves a delivery for a visibility timeout. Acknowledgement completes it for that queue. If the claim expires without completion, another consumer can attempt it, provided the queue is live and the attempt limit permits another claim.

Duplicate processing can happen when an application performs an effect but crashes before acknowledging, or when a worker continues after its lease expires. The SDK normally renews active deliveries, but database communication can fail. Respond to the delivery's stop signal and make effects idempotent.

At least once does not mean retry forever. A finite attempt limit can end in the DLQ. Expiring or deleting a queue can end its subscription. Administrative purges can remove pending and in-flight work. PostgreSQL data loss can remove committed queue state according to the deployment's durability and recovery characteristics.

Settlement and transactions​

Settlement applies to one message in one queue under the claim's token. It does not settle another subscriber's copy. A stale token cannot acknowledge a newer owner's attempt.

Database changes and acknowledgement can commit together when they share one transaction in the same database. Rollback preserves neither the application changes nor the acknowledgement. External HTTP requests, filesystem writes, and changes in another database are outside this boundary.

A network failure can leave a caller uncertain whether a publish or commit succeeded. Retrying cannot resolve that uncertainty by itself. Use application identities and transactionally recorded effects where recovery requires recognizing prior success.

Ordering​

FIFO applies within each group and queue, in grouped publication commit order. Only the group's head can proceed. Delays, retries, and a long-running head therefore delay successors. Other groups can proceed concurrently.

Dead-lettering or removing a head permits later messages to advance. Replaying that head afterward can expose older work after newer work has already run. Ordering does not deduplicate publications or fence external systems against an old worker that ignores cancellation. See FIFO queues and ordered delivery.

Failure outcomes​

EventQueue behaviorApplication or operator response
Worker crashes before acknowledgementClaim expires; another attempt becomes possible, or maintenance retires an exhausted final attempt.Tolerate duplicates and keep maintenance running.
Publication or commit response is lostCommit may have succeeded.Reconcile by application event ID; avoid assuming failure means no message.
Database is unavailableClaims, settlement, and extension cannot be confirmed.Stop work when ownership is no longer confirmed; recover connections and inspect state.
Settlement uses a stale tokenDatabase rejects ownership.Do not retry indefinitely or treat this as completion.
Notification is missedStored deliveries remain available.SDK polling discovers work; custom clients must also poll.
Exclusive queue expiresNew publications stop reaching it; its backlog cannot be resumed.Create a new subscription or choose Durable lifetime for recovery.

Availability, WAL durability, replication, and restored backups determine which committed state survives a database incident. See Availability and failover and Backup and recovery when choosing those guarantees.