0
0
Kafkadevops~10 mins

At-most-once delivery in Kafka - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the producer to at-most-once delivery by disabling retries.

Kafka
props.put("retries", [1]);
Drag options to blanks, or click blank then click option'
A5
B0
C-1
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Setting retries to a positive number causes retries, which is not at-most-once.
Using -1 enables infinite retries, which is not at-most-once.
2fill in blank
medium

Complete the code to disable idempotence for at-most-once delivery.

Kafka
props.put("enable.idempotence", [1]);
Drag options to blanks, or click blank then click option'
Afalse
Btrue
C"true"
D"false"
Attempts:
3 left
💡 Hint
Common Mistakes
Setting idempotence to true enables exactly-once semantics, not at-most-once.
Using string values instead of boolean can cause configuration errors.
3fill in blank
hard

Fix the error in the producer configuration to ensure at-most-once delivery by setting the acks correctly.

Kafka
props.put("acks", [1]);
Drag options to blanks, or click blank then click option'
A"0"
B"-1"
C"1"
D"all"
Attempts:
3 left
💡 Hint
Common Mistakes
Using "all" or "-1" waits for all replicas, which is not at-most-once.
Using "1" waits for leader acknowledgment, which can cause retries.
4fill in blank
hard

Fill both blanks to create a producer config map for at-most-once delivery with no retries and no idempotence.

Kafka
Map<String, Object> props = new HashMap<>();
props.put("retries", [1]);
props.put("enable.idempotence", [2]);
Drag options to blanks, or click blank then click option'
A0
Btrue
Cfalse
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Setting retries to 1 or more enables retries, breaking at-most-once.
Setting idempotence to true enables exactly-once semantics.
5fill in blank
hard

Fill all three blanks to configure a Kafka producer for at-most-once delivery: no retries, no idempotence, and no acknowledgments.

Kafka
props.put("retries", [1]);
props.put("enable.idempotence", [2]);
props.put("acks", [3]);
Drag options to blanks, or click blank then click option'
A1
Bfalse
C"0"
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using string "0" for retries instead of integer 0 causes errors.
Setting idempotence to true enables exactly-once semantics.
Setting acks to "1" or "all" waits for acknowledgments, not at-most-once.