What is event-driven architecture, and what do you gain and lose versus calling APIs directly?
Short answer
In an event-driven architecture, a service publishes events about what happened (OrderPlaced) to a broker and whoever cares listens; the producer doesn't know its consumers. You gain loose coupling and easy new features; you lose immediate consistency, get duplicate or out-of-order events, and tracing gets harder.
3 points to say:
- The producer publishes what happened (past tense) and doesn't know consumers: loose coupling, a new feature is just a new consumer.
- The cost: eventual consistency, duplicate events (at-least-once), out-of-order across partitions, harder debugging.
- Must-haves: transactional outbox, idempotent consumers, key per entity,
traceIdin headers.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.