Skip to content

type = improvement: Design durable outbox storage and relay #130

Description

@bartul

Related decision: #76
Related work: #129

type = improvement
status = proposed

Context/problem

Durable/web deployments need to prevent state committed, message lost failures. The terminal sandbox is currently in-memory and fire-and-forget, so an in-memory outbox would add ceremony without the durability guarantee.

Once durable persistence is selected, Rondel state changes and outbound messages must be committed atomically, and a relay must deliver pending messages with at-least-once semantics.

Proposed change

Design the durable outbox storage model and relay behavior for the selected persistence backend.

The design should cover:

  • OutboxMessage identity and payload metadata.
  • Destination classification for domain events and outbound bounded-context commands.
  • GameId and per-game ordering/sequence requirements.
  • Attempt count, timestamps, retry/backoff, processed status, and dead-letter/poison-message handling.
  • Atomic commit semantics for state plus outbox messages.
  • Relay delivery and acknowledgment semantics.
  • Observability needed to diagnose stuck messages and repeated delivery failures.

Acceptance criteria

  • Persistence transaction constraints are documented for the chosen backend.
  • State and outbox messages are committed atomically, or the design explicitly rejects the backend as unsuitable.
  • Relay leaves failed deliveries pending for retry.
  • Relay acknowledges messages only after successful delivery.
  • Duplicate delivery after relay crash or acknowledge failure is documented as expected behavior.
  • Per-GameId ordering requirements are specified and tested.
  • Tests cover atomic commit success, rollback/no partial commit, retry after delivery failure, and duplicate delivery after acknowledge failure.

Consequences

This provides the durable half of the outbox/inbox strategy. It intentionally does not claim exactly-once delivery by itself; consumers still need idempotent inbox or business-level idempotency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions