Design: Notification to All Parties System
Design covers notification sending, scheduling, retry, and status tracking. Does not cover user management or content creation for notifications.
Functional Requirements
Non-Functional Requirements
Jump into concepts and practice - no test required
+-------------------+ +------------------+ +---------------------+
| Notification | | Notification | | Notification |
| Request Handler | ----> | Scheduler | ----> | Message Queue |
+-------------------+ +------------------+ +---------------------+
|
v
+---------------------+ +---------------------+ +---------------------+
| Email Dispatcher | | SMS Dispatcher | | Push Notification |
| (SMTP or API) | | (SMS Gateway API) | | Dispatcher |
+---------------------+ +---------------------+ +---------------------+
| | |
v v v
+---------------------+ +---------------------+ +---------------------+
| Delivery Status | | Delivery Status | | Delivery Status |
| Tracker DB | | Tracker DB | | Tracker DB |
+---------------------+ +---------------------+ +---------------------+
Retry Mechanism monitors failures and resubmits messages.
Monitoring & Alerting watches system health and failures.What is the main purpose of a notification system that sends messages to all parties?
Which of the following is the correct way to represent a notification service that sends messages to all parties in pseudocode?
function notifyAll(parties, message) {
for (let i = 0; i < parties.length; i++) {
parties[i].send(message);
}
}Consider this code snippet for notifying parties:
parties = ["Alice", "Bob", "Charlie"]
function notifyAll(parties, message) {
let notified = []
for (const person of parties) {
notified.push(person + ": " + message)
}
return notified
}
console.log(notifyAll(parties, "Meeting at 5 PM"))What will be the output?
Identify the bug in this notification function and select the fix:
function notifyAll(parties, message) {
for (let i = 0; i < parties.length; i++) {
parties.send(message)
}
}parties.send(message) to parties[i].send(message) -> Option DYou are designing a notification system to alert all parties involved in a project. Which design choice best ensures scalability and reliability?