When observers need updates at different times, the plain Observer pattern's synchronous, immediate notifyObservers() is not enough. You extend it with prioritization, scheduling, or queuing so each observer receives updates according to its own timing requirements rather than all at once.
Key Points: • Assign priorities to observers and notify high-priority ones first if ordering matters. • Introduce a message/event queue between the subject and observers so updates can be delayed or batched. • Use a scheduler (e.g., a fixed-delay task or cron-like trigger) to push updates to time-sensitive observers at set intervals. • Filter or throttle updates per observer so fast-changing subjects don't overwhelm slower consumers. • Consider an event bus or messaging system (e.g., Kafka, an in-process event bus) when the number of observers and update patterns grows complex.
Example: A stock price subject might notify a real-time trading dashboard immediately, but batch updates every five minutes for a reporting observer, using separate notification paths keyed by observer type.
Interview Tip: A concise interview answer is:
"When observers have different update needs, I don't rely on a single synchronous notifyObservers() call — I add prioritization or route updates through a queue or scheduler so each observer gets notified on its own cadence. That keeps fast, critical observers responsive without forcing slower ones to process every single update."