How does the Observer pattern scale in event-driven and distributed systems?

Answer

The classic GoF Observer has limitations at scale: the subject holds direct references to observers, making it synchronous, in-process, and tightly coupled. In event-driven architectures, this evolves into a publish-subscribe (Pub/Sub) model with a message broker (Kafka, RabbitMQ, Redis Pub/Sub) as the intermediary. Publishers emit events to a topic; subscribers consume from topics independently. This decouples producers and consumers completely — they don't know about each other, can run in separate processes, and can scale independently. Additional capabilities emerge: durable subscriptions (events are stored and can be replayed), fan-out (one event to thousands of consumers), and back-pressure. In microservices, this becomes the Event-Driven Architecture (EDA) pattern where services communicate exclusively through domain events, enabling loose coupling and eventual consistency across services.