nerdexam
Confluent

CCDAK · Question #216

You are writing to a topic with producer config acks=all. The producer is receiving acknowledgements from the Kafka broker indicating that messages are being written to the Kafka topic. You notice…

The correct answer is C. enable.idempotence=true. To avoid duplicate messages due to retries after timeouts, you should set: - enable.idempotence=true: Ensures Kafka tracks message sequence numbers and deduplicates - retries=2147483647: Allows the producer to retry indefinitely on transient failures…

Developing Kafka Producers

Question

You are writing to a topic with producer config acks=all. The producer is receiving acknowledgements from the Kafka broker indicating that messages are being written to the Kafka topic. You notice duplicate messages and investigate. You discover that the producer acknowledgement timed out due to network delay and is resending messages assuming that they were not written to the Kafka topic. This is creating the duplicate messages. You need to ensure duplicate messages are not created. Which producer configuration should you set?

Options

  • Aenable.auto.commit=true
  • Benable.idempotence=true
  • Cenable.idempotence=true
  • Denable.idempotence=false

How the community answered

(47 responses)
  • A
    9% (4)
  • B
    6% (3)
  • C
    83% (39)
  • D
    2% (1)

Explanation

To avoid duplicate messages due to retries after timeouts, you should set: - enable.idempotence=true: Ensures Kafka tracks message sequence numbers and deduplicates - retries=2147483647: Allows the producer to retry indefinitely on transient failures. - max.in.flight.requests.per.connection=5: Keeps the number of in-flight messages within the safe limit for idempotence to work correctly (≤5).

Topics

#idempotent producer#duplicate messages#enable.idempotence#exactly-once semantics

Community Discussion

No community discussion yet for this question.

Full CCDAK Practice