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

إعادة المحاولة والتراجع التدريجي وDLQs

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

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

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

في هذا الدرس

retry transient failures sensibly and park permanent ones.

الموضوعات المخطط لها

  • Transient failures (timeout, deadlock) deserve a retry; permanent ones (bad payload, rule violation) never succeed.
  • Use exponential backoff with a maximum attempt count; blocking retries stall the partition, so use retry topics for long delays.
  • After the limit, send the message to a dead-letter queue (DLQ) with the error and original headers.
  • Alert on DLQ depth and provide a way to replay after the fix.
  • Spring Kafka offers DefaultErrorHandler with backoff and a dead-letter recoverer (verify version before recording).
تفاصيل المخطط المبدئي

عرض عملي

java
var handler = new DefaultErrorHandler(
    new DeadLetterPublishingRecoverer(template),
    new ExponentialBackOff(500, 2.0)); // add a max elapsed time or attempts

اختبر فهمك

Why should a malformed payload go straight to the DLQ?

أظهر الإجابة

Retrying cannot fix it and only delays the messages behind it.

التطبيق

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

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

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

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