Event-Driven Architecture
Problem Statement
Design a highly scalable, loosely coupled, and asynchronous system using Event-Driven Architecture (EDA) principles.
The goal is to handle communication between multiple microservices or modules through events rather than direct synchronous API calls.
You need to demonstrate how your system:
🧾 Context
Modern distributed systems — like e-commerce platforms, logistics tracking, or streaming services — rely on event-driven designs to ensure decoupling, real-time updates, and high throughput.
In this problem, you will design an event-driven architecture for a system where multiple services communicate via event buses/message brokers (e.g., Kafka, RabbitMQ, or AWS SNS/SQS).
🧱 Problem Statement
Design a scalable Event-Driven Architecture that enables multiple independent services to communicate asynchronously through events, ensuring reliability, high throughput, and fault tolerance.
Your design should cover:
📋 Functional Requirements
⚙️ Non-Functional Requirements
Attribute and Description
Scalability
Must handle high event throughput with low latency.
Reliability
No event loss even during broker failures.
Durability
Persist events for replay and auditing.
Fault Tolerance
Consumers should recover from crashes gracefully.
Decoupling
Producers and consumers should evolve independently.
Consistency
Ensure eventual consistency across services.
🧩 High-Level Architecture
Core Components
Example Architecture Diagram (Textual Representation)
1
2[Order Service] ───► [Event Broker: Kafka Topic "OrderPlaced"] ───► [Payment Service]
3 └──► [Inventory Service]
4 └──► [Notification Service]Each microservice publishes and consumes events asynchronously through Kafka topics or message queues.
🧠 Example Scenario — E-commerce Order Workflow
Flow:
🧮 Scalability Considerations
🧰 Tech Stack (Example Choices)
Component and Technology
Message Broker
Apache Kafka / RabbitMQ / AWS SNS + SQS
Producers/Consumers
Spring Boot, Node.js, or Go microservices
Schema Registry
Confluent Schema Registry (for Avro/JSON schema evolution)
Monitoring
Prometheus + Grafana or ELK stack
Event Store (Optional)
PostgreSQL / Cassandra / S3 bucket
⚠️ Challenges and Trade-offs
Design AspectTrade-off
At-least-once vs Exactly-once Delivery
Exactly-once adds complexity and cost; at-least-once often acceptable.
Ordering Guarantees
Kafka ensures ordering per partition, not globally.
Event Schema Evolution
Requires versioning to avoid consumer failures.
Error Handling
Failed messages go to Dead Letter Queues (DLQs).
System Observability
Harder to trace asynchronous event chains.
📊 Key Discussion Topics in Interview
🚀 Expected Deliverables
DeliverableDescription
System Overview
Description of services, message flow, and event lifecycle.
Architecture Diagram
Depict event producers, broker, consumers, and flow.
Data Flow Diagram
Sequence of event publication and consumption.
Scaling & Recovery Strategy
Partitioning, retries, DLQs, replay mechanisms.
Challenges & Solutions
Explain trade-offs and design decisions.
✅ Example Problem Statement Summary
Design a scalable Event-Driven Architecture to connect multiple microservices in an e-commerce system, where services publish and consume events asynchronously using a message broker (like Kafka or RabbitMQ). The architecture should ensure reliability, ordering, fault tolerance, and support for event replay and monitoring.