Event-Driven Infrastructure Pattern
System diagram
Architectural overview
Producers emit domain events to a central bus; consumers process asynchronously. Decouples services and enables audit trails, replay, and new consumers without changing producers.
Tradeoffs
- Eventual consistency; avoid using events for synchronous, strict consistency requirements.
- Schema evolution and versioning require discipline.
Scaling considerations
Partition topics by key (e.g. account_id). Scale consumers with consumer groups. Retain events for replay and audit; compact or archive by policy.
Common pitfalls
- Using events for request-response; use APIs for that.
- No idempotent handling, so duplicate events cause duplicate side effects.