Mục tiêu: Master event types, message broker patterns, MassTransit framework, và idempotency.
1. Event Types
Domain Events:
- Internal trong 1 bounded context
- Raised bởi Aggregate Root
- Dispatch trong cùng transaction (MediatR)
- VD: OrderItemAdded, PriceChanged
Integration Events:
- Cross bounded context / cross service
- Publish qua message broker (RabbitMQ, Service Bus)
- Eventually consistent
- VD: OrderSubmittedIntegrationEvent
Event Notifications:
- Lightweight, chỉ chứa ID