Bird
Raised Fist0

Identify the error in this Kafka producer configuration for at-most-once delivery:

medium📝 Debug Q14 of Q15
Kafka - Message Delivery Semantics

Identify the error in this Kafka producer configuration for at-most-once delivery:

producer = KafkaProducer(acks=1, retries=0)
producer.send('topic', b'message')
Aacks=1 causes waiting for leader ack, not at-most-once
Bretries=0 causes infinite retries
CMissing <code>enable.idempotence=True</code>
DTopic name must be uppercase
Step-by-Step Solution
Solution:
  1. Step 1: Check acks setting

    acks=1 means the producer waits for leader acknowledgment, allowing retries and possible duplicates, not at-most-once.
  2. Step 2: Verify retries and other settings

    Retries=0 disables retries, but acks=1 still waits for confirmation, so this is not pure at-most-once.
  3. Final Answer:

    acks=1 causes waiting for leader ack, not at-most-once -> Option A
  4. Quick Check:

    acks must be 0 for at-most-once [OK]
Quick Trick: acks must be 0 for at-most-once delivery [OK]
Common Mistakes:
MISTAKES
  • Thinking retries=0 means no retries but ignoring acks effect
  • Assuming idempotence is required for at-most-once
  • Believing topic names must be uppercase

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes