What is event-driven architecture and how does it apply to microservices?
Answer
Event-driven architecture (EDA) is a design paradigm where services communicate by producing and consuming events — records of things that happened — rather than by calling each other directly. A service publishes an event (e.g., OrderPlaced) to a broker without knowing who will consume it. Interested services subscribe and react asynchronously. This creates extremely loose coupling and enables patterns like event sourcing and CQRS. In a microservices system, EDA allows a single business action to trigger work across many services (email, inventory, analytics) without any of them being tightly coupled. The main challenges are eventual consistency, lack of a single synchronous response, and making distributed workflows observable and debuggable.