Design: Notification on State Change System
Design covers detection of state changes, notification dispatch, subscription management, and audit logging. Out of scope are the internal state management of entities and third-party notification service implementations.
Functional Requirements
FR1: Detect changes in the state of an entity (e.g., order status, device status).
FR2: Send notifications to users or systems when a state change occurs.
FR3: Support multiple notification channels (e.g., email, SMS, push notifications).
FR4: Allow users to subscribe or unsubscribe from notifications for specific state changes.
FR5: Ensure notifications are delivered reliably and in a timely manner.
FR6: Provide an audit log of all state changes and notifications sent.
Non-Functional Requirements
NFR1: Handle up to 10,000 state changes per minute.
NFR2: Notification delivery latency should be under 5 seconds for 95% of notifications.
NFR3: System availability should be at least 99.9% uptime.
NFR4: Support eventual consistency for notification delivery status.
NFR5: Ensure data privacy and security for user contact information.