SteelReed

Search

Search posts, questions…

MicroservicesQuestion 9 / 24

Middle

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.

OrderPlaced via outboxadded later, OrderunchangedOrder serviceKafka topic order-eventsPaymentNotificationLoyalty

3 points to say:

  1. The producer publishes what happened (past tense) and doesn't know consumers: loose coupling, a new feature is just a new consumer.
  2. The cost: eventual consistency, duplicate events (at-least-once), out-of-order across partitions, harder debugging.
  3. Must-haves: transactional outbox, idempotent consumers, key per entity, traceId in 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.