تأثيرات مرة واحدة بالضبط (Exactly-once effects)
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
distinguish unavailable exactly-once delivery from designable exactly-once effects.
الموضوعات المخطط لها
- Over an unreliable network a sender cannot know whether a message arrived, so it retries; delivery is at-least-once or at-most-once.
- Exactly-once effects: make duplicates harmless with idempotency keys, deduplication tables, and conditional updates.
- Some platform features (for example Kafka transactions) give exactly-once processing inside their own boundary; effects outside, such as charging a card, still need idempotency. Verify the guarantees for your versions.
- Pass an idempotency key to external providers and store the result per key.
تفاصيل المخطط المبدئي
عرض عملي
INSERT INTO processed(event_id) ... ON CONFLICT DO NOTHING, with the side effect applied only when the insert succeeds, in the same transaction. Provider call with Idempotency-Key: order-123-attempt-1.
اختبر فهمك
How do you get exactly-once effects from at-least-once delivery?
أظهر الإجابة
Make handling idempotent, so repeated deliveries have the same effect as one.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.