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. نموذج تعليمي — الأرقام توضّح سلوكًا وليست قياسات أداء.

المفاهيم

مفيد قبل هذا التحدي

تحديات ذات صلة

المراجع