Skip to content

Transactional outbox

The order service writes the order and an outbox row in one transaction. A relay reads the row, publishes the event to a broker, and marks the row sent. The broker can time out after it has already delivered the message, so the relay retries and the event arrives twice. The consumer applies every delivery it gets:

src/outbox.ts
export function consume(applied: number): number {
return applied + 1;
}

See how stifinder finds and fixes it.

Last updated: