The Real Fullstack

The Missing Event

The order is in the database. Why was it never shipped?

Ingeniero sénior10 minSimulador de flujosReto de código
kafkapostgresqlspring-bootdebeziumjava

Este reto aún no está traducido al Español. Estás leyendo la versión en inglés.

Misión:Reproduce the lost event, then make the database write and the event consistent under every combination of crashes, rollbacks, broker outages and relay restarts.Contexto · Objetivos de aprendizaje ▾

Brightcart's order service saves an order, then publishes OrderPlaced to Kafka for shipping. Every week a few orders are never shipped. They all coincide with deployments or short broker outages. An earlier attempt to publish inside the transaction created shipments for orders that didn't exist.

Misión: Reproduce the lost event, then make the database write and the event consistent under every combination of crashes, rollbacks, broker outages and relay restarts.

Objetivos de aprendizaje

  • Explain the dual-write problem between a database and a broker.
  • Implement the transactional outbox.
  • Pair at-least-once publishing with idempotent consumers.
SimulaciónSimulado
Order serviceOrders DBOutbox relayorders topicShipping
Ejecutar simulación

Ejecuta la simulación para ver la salida.

Simplificación

Four failure points; each happens at most once. Real relays also need ordering per aggregate and cleanup of sent rows. Modelo educativo: los números ilustran un comportamiento, no son benchmarks.

Conceptos

Útil antes de este

Retos relacionados

Referencias