The Real Fullstack

The Missing Event

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

高级工程师10 分钟流程模拟器代码挑战
kafkapostgresqlspring-bootdebeziumjava

此挑战尚未翻译为简体中文,你正在阅读英文版本。

任务:Reproduce the lost event, then make the database write and the event consistent under every combination of crashes, rollbacks, broker outages and relay restarts.背景 · 学习目标 ▾

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.

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

学习目标

  • Explain the dual-write problem between a database and a broker.
  • Implement the transactional outbox.
  • Pair at-least-once publishing with idempotent consumers.
模拟模拟数据
Order serviceOrders DBOutbox relayorders topicShipping
运行模拟

运行模拟以查看输出。

简化说明

Four failure points; each happens at most once. Real relays also need ordering per aggregate and cleanup of sent rows. 教学模型——数字用于说明行为,并非基准测试。

概念

建议先完成

相关挑战

参考资料