← Alle Vorlagen

Ereignisse mit den Daten gespeichert, mindestens einmal zugestellt, geordnet pro Schlüssel.

Spec — Transactional outbox

Status: draft · Created: 2026-11-10

1. Context and goal

Every change other services must hear about produces its event reliably, with no gap between committing the data and publishing the message.

2. Functional requirements (EARS)

  • FR-1: WHEN a business change commits, THE SYSTEM SHALL have written its event to an outbox table in the same database transaction, and IF the transaction rolls back, THEN no event SHALL remain.
  • FR-2: THE SYSTEM SHALL publish outbox events to the broker within 2 seconds of the commit under normal load, and mark each one published only after the broker acknowledges it.
  • FR-3: IF publishing fails or the relay crashes, THEN THE SYSTEM SHALL publish the event again with the same event id, so every event is delivered at least once.
  • FR-4: THE SYSTEM SHALL publish events with the same key (for example the aggregate id) in commit order, never before an earlier event with that key.
  • FR-5: WHILE several relay instances run, THE SYSTEM SHALL let only one of them publish the events of a given key.
  • FR-6: THE SYSTEM SHALL delete published events after 7 days, and alert when the oldest unpublished event is more than 1 minute old.

3. Out of scope

  • Exactly-once delivery to consumers.
  • A global order across different keys.