The Real Fullstack

The Missing Event

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

Engenheiro sênior10 minSimulador de fluxoDesafio de código
kafkapostgresqlspring-bootdebeziumjava

Este desafio ainda não foi traduzido para Português (Brasil). Você está lendo a versão em inglês.

Missão: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 aprendizagem ▾

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.

Missão: 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 aprendizagem

  • Explain the dual-write problem between a database and a broker.
  • Implement the transactional outbox.
  • Pair at-least-once publishing with idempotent consumers.
SimulaçãoSimulado
Order serviceOrders DBOutbox relayorders topicShipping
Executar simulação

Execute a simulação para ver a saída.

Simplificação

Four failure points; each happens at most once. Real relays also need ordering per aggregate and cleanup of sent rows. Modelo educacional — os números ilustram comportamento, não são benchmarks.

Conceitos

Útil antes deste

Desafios relacionados

Referências