Design: Outbox Pattern for Reliable Event Delivery
Design focuses on the microservice implementing the outbox pattern and event delivery mechanism. Event consumers and their processing logic are out of scope.
Functional Requirements
FR1: Ensure events generated by a microservice are reliably delivered to other services.
FR2: Guarantee no events are lost even if the service crashes after database update but before event publishing.
FR3: Support eventual consistency between the service's database and event consumers.
FR4: Allow event consumers to process events asynchronously.
FR5: Handle high throughput of events with minimal latency.
FR6: Provide visibility into event delivery status for monitoring and debugging.
Non-Functional Requirements
NFR1: System must handle 10,000 events per second.
NFR2: Event delivery latency p99 should be under 500ms.
NFR3: System availability target is 99.9% uptime.
NFR4: Events must be delivered at least once (idempotency handled by consumers).
NFR5: Use existing relational database for service data storage.