انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهMID-029-L07

عرض عملي: معالجة الرسالة نفسها مرتين بأمان

  • الدرس 7 من 7
  • Mid-level
في هذا الدرس 3 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

show duplicate delivery and make inventory immune. Prepares MID-029-LAB1.

تفاصيل المخطط المبدئي

خطوة بخطوة

  1. Publish one OrderPlaced event to inventory; stock drops by 2.
  2. Replay the same record (reset the offset or resend); stock drops by 2 again. Show the bug.
  3. Add an inbox table with the event id as primary key and insert it in the same transaction.
  4. Planned mistake: keep processed ids in a HashSet. Restart the service, replay, and the duplicate is applied. Fix: durable inbox row.
  5. Replay again: the unique violation is caught, stock is unchanged, and a log line says "duplicate skipped".

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.