Skip to main content

Module events

Module events 

Source
Expand description

The Postgres side of domain events (ADR-0018 § 4): the outbox the relay reads, the db transport (event_deliveries) and the dead-letter sink every transport writes to. The tables are migrations/outbox.sql, which puerto new --events writes into the project.

Structs§

PgDeadLetters
dead_letters, whatever the transport. Recording the same event for the same consumer twice keeps the first record (dead_letters_event_consumer).
PgDeliveries
The relay’s publisher on the db transport: fans each event out to the consumers subscribed to its type and marks it published, in one transaction.
PgOutbox
The outbox, as the relay reads it.
PgSubscription
One consumer’s input on the db transport.

Constants§

DEFAULT_CLAIM_LEASE
How long a claimed delivery stays invisible to other claims. A worker that dies while handling one leaves it due again after this — at-least-once, never lost.
RELAY_LOCK_KEY
The advisory lock the relay holds: only one worker replica relays, so the outbox order is kept. The bytes of "puerto".