Design: Event-Driven Microservices Communication
Focus on communication patterns between microservices using events. Out of scope: detailed implementation of each microservice business logic.
Functional Requirements
Non-Functional Requirements
Jump into concepts and practice - no test required
+----------------+ +----------------+ +----------------+
| Service A | | Event Broker | | Service B |
| (Producer) | ----> | (Kafka/Rabbit) | <---- | (Consumer) |
+----------------+ +----------------+ +----------------+
| | |
| | |
+----> Event published --+ |
+----> Event consumed --+
eventBus.publish('OrderCreated', { orderId: 123 });
// Service B listens for 'OrderCreated' and processes the order asynchronously
What is the main benefit of this event-based approach?eventBus.publish('UserCreated', userData);
userService.createUser(userData);
What is the main problem with this approach regarding decoupling?