Design: Publish/Subscribe Messaging System
Design the core pub/sub messaging system including message routing, topic management, and delivery guarantees. Out of scope: detailed client SDKs, security/authentication mechanisms, and UI.
Functional Requirements
FR1: Allow multiple publishers to send messages without knowing subscribers
FR2: Allow multiple subscribers to receive messages they are interested in
FR3: Support message filtering by topic or category
FR4: Ensure messages are delivered to all relevant subscribers
FR5: Handle at least 10,000 concurrent publishers and subscribers
FR6: Provide message delivery latency under 200ms (p99)
FR7: Support message persistence for reliability
Non-Functional Requirements
NFR1: System must be highly available with 99.9% uptime
NFR2: Must scale horizontally to handle increasing load
NFR3: Messages should be delivered in near real-time
NFR4: Subscribers should not block publishers