Bird
0
0

You want to implement a Dead Letter Queue pattern in Kafka that retries failed messages up to 3 times before sending them to the DLQ. Which approach correctly achieves this?

hard📝 Application Q15 of 15
Kafka - Event-Driven Architecture
You want to implement a Dead Letter Queue pattern in Kafka that retries failed messages up to 3 times before sending them to the DLQ. Which approach correctly achieves this?
AUse a retry counter in message headers; on failure increment and retry, else send to DLQ after 3 tries
BSend all failed messages immediately to DLQ without retries
CConfigure Kafka broker to automatically retry messages 3 times before DLQ
DUse a separate consumer that deletes messages after 3 retries
Step-by-Step Solution
Solution:
  1. Step 1: Understand retry logic with DLQ

    Retries require tracking how many times a message was processed; using headers to count retries is common.
  2. Step 2: Implement conditional retry or DLQ send

    If retry count is less than 3, retry processing; if 3 or more, send message to DLQ topic.
  3. Step 3: Evaluate other options

    Kafka broker does not handle retries automatically; immediate DLQ send skips retries; deleting messages after retries is incorrect.
  4. Final Answer:

    Use a retry counter in message headers; on failure increment and retry, else send to DLQ after 3 tries -> Option A
  5. Quick Check:

    Retry count in headers controls DLQ after 3 tries [OK]
Quick Trick: Track retries in headers; send to DLQ after max retries [OK]
Common Mistakes:
  • Expecting Kafka broker to retry automatically
  • Sending all failures immediately to DLQ
  • Deleting messages instead of sending to DLQ

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes