The Real Fullstack

The Disappearing Order

The order is in the database, the payment cleared, the warehouse never heard of it. Where did it go?

معماري14 دقيقةمحاكي التدفّقتحدي الشيفرة
spring-bootpostgresqlkafkadebezium

لم يُترجم هذا التحدي إلى العربية بعد. أنت تقرأ النسخة الإنجليزية.

المهمة:Fix the publishing guarantee (Backend), the consumer guarantee (Reliability), then prove consistency under every failure (Fullstack).السياق · أهداف التعلّم ▾

A Brightcart customer complains after ten days. Tracing shows the order service committed the order, then the pod was evicted during a node drain before publishing OrderPlaced. Earlier fixes created phantom shipments; the outbox relay sometimes publishes twice after restarts.

المهمة: Fix the publishing guarantee (Backend), the consumer guarantee (Reliability), then prove consistency under every failure (Fullstack).

أهداف التعلّم

  • Recognise dual-write failures in production traces.
  • Combine the transactional outbox with idempotent consumers.
  • Reason about guarantees across services, not inside one.
المحاكاةمحاكاة
Order serviceOrders DBOutbox relay / CDCorders topicShipping
تشغيل المحاكاة
// order + outbox row in one transaction; Debezium streams the outbox table to Kafka@Transactionalpublic Order place(OrderCommand c) {  Order o = orders.save(Order.from(c));  outbox.save(OutboxEvent.of("Order", o.id(), "OrderPlaced", payload(o)));  return o;}// shipping consumer: processed_events(event_id PRIMARY KEY) inserted in the same transaction as the shipment

تبسيط

Reuses the outbox model: four failure points, worst case over all combinations. نموذج تعليمي — الأرقام توضّح سلوكًا وليست قياسات أداء.

المفاهيم

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

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

المراجع