I started with the subscription store and the event source, which felt natural, but I got tripped up when they pushed on the fanout side.
Start by clarifying requirements and scale, then design a high-level architecture that separates availability detection, notification processing, and delivery. Focus on trade-offs like polling vs. event-driven, deduplication strategies, and scalability to handle millions of watchers.
Pro tip: Emphasize idempotency and exactly-once delivery semantics to avoid duplicate notifications, and discuss how to handle race conditions when multiple users watch the same listing.
Ask about the number of listings, users, expected notification volume, latency requirements, and supported channels. This sets the stage for design decisions.
Propose components: a watcher service to manage subscriptions, an availability detection service (e.g., polling or event-driven), a notification service with deduplication, and a delivery service for various channels.
Design schemas for subscriptions (user, listing, criteria, channel preference) and notification logs (to track sent notifications and avoid duplicates). Choose appropriate databases (e.g., SQL for subscriptions, NoSQL for logs).
Explain how to detect availability changes (e.g., via webhooks, change data capture, or periodic polling) and match against active subscriptions efficiently, possibly using an inverted index or streaming processing.
Describe the notification pipeline: enqueue matched events, deduplicate using a unique key (e.g., user+listing+date range), and deliver via user's preferred channel with retries and fallbacks.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.