Notification System LLD | Asked in Microsoft, Paypal, Walmart

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-10-01Added By Anonymous
Source: Link

Company: Walmart
Role: l4, l5
Interview Stage: Onsite
Location: unknown
Year: unknown

Original Post Content:

You are tasked with designing a Notification System that allows users to send and receive notifications across multiple channels while adhering to object-oriented design principles.

Difficulty: Medium → Hard
Companies Asked: Microsoft, PayPal, Walmart
NotificationSystemUML.png

Requirements

Users

  • Each user has a unique ID.
  • Users can subscribe/unsubscribe to notification types.
  • Users can manage preferences, including frequency and channels.

Notification Channels

  • Support multiple channels: Email, SMS, Push, In-App.
  • Each channel has its own delivery mechanism and requirements.

Notification Types

  • Users can subscribe to notifications like new messages, friend requests, system alerts, promotional messages, security alerts, or custom events.
  • Each type may require specialized delivery formatting.

Bonus Requirements

  • Personalization – notifications can include user-specific data, such as name or event-specific information.
  • Opt-out & Preferences – users can fully unsubscribe or manage preferences at a granular level.

Entities

  • User – id, name, email, phoneNumber, globalOptOut, optedOutTypes, preferences
  • Notification – id, type, title, content, createdAt, personalizationData, sender
  • NotificationType (Interface) – getNotificationType(), formatContent(), hasSpecializedDeliveryRequirement()
  • NotificationChannel (Interface) – getChannelName(), sendNotification(), isChannelAvailableForUser()
  • Publisher (Interface) – publishNotification(), start(), stop()
  • NotificationBroker – manages users, subscriptions, channels, registered publishers, async dispatch

Flow

1.A Publisher publishes a notification.
2.The NotificationBroker finds subscribed users by NotificationTypeEnum.
3.For each user, the broker resolves preferred ChannelTypes, validates availability, and dispatches asynchronously.
4.Channels personalize and send content, returning success/failure.

Key Features Implemented

  • Pub-Sub Pattern (used over Observer Pattern) for decoupled, scalable notification routing.
  • Multithreaded async dispatch using ExecutorService for performance.
  • Easy to add new notification types or channels without major refactoring.
  • Fully supports personalization, opt-outs, and channel preferences.

📌 UML Diagram attached
📌 GitHub code link available in the video description
🎥 Watch the full implementation here: https://youtu.be/pjyqW1zFvDY

Comments