The Skipped Outbox Row
An order service writes the business row and its event in one transaction, which is the outbox pattern done right:
BEGIN;
INSERT INTO orders (id, user_id, total_cents) VALUES ($1, $2, $3);
INSERT INTO outbox (payload) VALUES ($4); -- id BIGSERIAL PRIMARY KEY
COMMIT;
The relay polls and remembers a high-water mark:
-- every 200ms, with :last held in the relay's memory
SELECT id, payload FROM outbox WHERE id > :last ORDER BY id LIMIT 500;
-- then: last = max(id) of the returned rows
Under load, a small fraction of events are never published. Nothing errors and no row is missing from outbox. Diagnose it.
Sign in to answer questions and track your progress
Sign In