What is event-driven architecture?
Answer
Event-driven architecture (EDA) is a software design pattern where components communicate by producing and consuming events — notifications that something happened — rather than direct synchronous calls. Core components: Event producers: generate events when something happens (user registered, order placed, payment processed); Event broker: receives, stores, and routes events (Kafka, RabbitMQ, AWS EventBridge, SNS/SQS); Event consumers: subscribe to events and react (send welcome email, update inventory, generate invoice). Event types: Domain events: something that happened in the business domain (OrderPlaced, PaymentSucceeded); Integration events: crossing microservice boundaries; Commands vs Events: commands are directed requests ("send email to user 1"); events are facts ("user 1 registered" — anyone can react). Benefits: loose coupling (producers don't know consumers), scalability (consumers scale independently), resilience (consumer failures don't affect producer), extensibility (add new consumers without changing producers), event replay (reprocess past events for new features). Challenges: eventual consistency, complex debugging (trace event chains), event schema evolution, duplicate events (consumers must be idempotent). Patterns: Event Sourcing (store events as the source of truth, derive state), CQRS (separate read/write models), Choreography (services react to events) vs Orchestration (central orchestrator directs services).
Previous
What is a data lake vs a data warehouse?
Next
What is the difference between synchronous and asynchronous replication?