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. 教育用モデルです。数値は挙動を示すためのもので、ベンチマークではありません。

コンセプト

先に取り組むと役立つ課題

関連する課題

参考資料