ADR-BW-008: Persist configured broker handoffs with local inboxes and outboxes
Use the shared event framework's per-service durable message storage without claiming exactly-once business effects.
| Field | Value |
|---|---|
| Status | Proposed |
| Date | 2026-11-07 |
| Owners | Platform Engineering TeamTeamPlatform Engineering TeamPlatform team providing BookWorm's thinnest viable platform—orchestration, messaging fabric, scheduling, notifications, ...Open docs |
| Affected Resources | BookWormDomainv1.0.0BookWormCore e-commerce domain for the BookWorm online bookstore, coordinating catalog discovery, customer baskets, order fulfil...Ownerarchitecture-enabling-teamDiagramRepositoryOpen docs |
| Related ADRs | ADR-BW-005: Use Kafka for configured asynchronous integrationDecision Recordv1.0.0ADR-BW-005: Use Kafka for configured asynchronous integrationRetain the shared Wolverine Kafka integration for asynchronous cross-capability messages where a broker is configured.Ownerplatform-engineering-teamOpen docs, ADR-BW-012: Select resilience according to operation semanticsDecision Recordv1.0.0ADR-BW-012: Select resilience according to operation semanticsUse shared outbound defaults and capability-specific failure handling without equating retries or duplicate guards with ...Ownerplatform-engineering-teamOpen docs, ADR-002: Persist saga state and messages in Finance PostgreSQLDecision Recordv1.0.0ADR-002: Persist saga state and messages in Finance PostgreSQLFinance combines EF Core saga storage with Wolverine PostgreSQL envelope persistence and transaction integration in its ...Ownercommerce-fulfillment-teamOpen docs |
Context & Problem Statement
A service can crash or restart after committing local state but before publishing an integration event to Kafka. Without durable handoffs, downstream workflows stall silently. At the same time, forcing stateless or Redis-backed workers to adopt a relational database just for an outbox adds unnecessary operational weight.
Decision Drivers
- Crash recovery: Preserve pending outgoing messages across process restarts.
- Storage proportionality: Match durability mechanisms to each service’s existing persistence model.
- At-least-once honesty: Require idempotent consumers rather than claiming exactly-once delivery.
Options Considered
| Option | Pros | Cons |
|---|---|---|
| Match durable handoffs to each service’s native storage | Atomic outbox where relational DBs exist; lightweight guards elsewhere | Recovery tooling varies slightly by service storage type |
| Mandate PostgreSQL outbox for every service | Uniform SQL outbox pattern everywhere | Forces unnecessary databases onto stateless/Redis services |
| In-memory fire-and-forget publishing | Minimal setup | Process crashes permanently lose pending integration events |
| Distributed two-phase commit (2PC) | Attempts atomic cross-system commits | Fragile, unsupported by external APIs, and degrades availability |
Decision & Consequences
Chosen Option: Persist broker handoffs using each service’s native durability mechanism (transactional PostgreSQL outboxes in Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs, Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs, Order OrchestrationServicev1.0.0Order OrchestrationMessage-driven Finance workflow service that coordinates post-checkout basket cleanup and order notifications using Dura...PublishesPlaceOrderCommand, DeleteBasketCompleteCommand +3SubscribesUserCheckedOutIntegrationEvent, OrderStatusChangedToCompleteIntegrationEvent +3APIsAsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs, and Scheduler ServiceServicev1.0.0Scheduler ServiceSingle-host Quartz.NET job execution engine and operational dashboard UI for scheduling recurring platform jobs and insp...PublishesProcessVectorBatchIntegrationEventAPIsAsyncAPIOwnerplatform-engineering-teamDiagramRepositoryOpen docs; idempotency guards and DLQs in Redis/stateless workers). All consumers must treat delivery as at-least-once and handle duplicates idempotently.
- Positive: Prevents lost events on crash without burdening stateless services with extra databases.
- Negative: Operators must understand both SQL outbox inspection and Redis/DLQ recovery paths.
Compliance Criteria
- Relational-backed services publishing Kafka messages must use a transactional outbox.
- All Kafka consumers must implement idempotent handling (e.g., 24-hour idempotency guards or natural idempotency).
- Documentation must never claim “exactly-once” side effects across external brokers or SMTP providers.