0
0
Kafkadevops~10 mins

Why delivery guarantees affect correctness in Kafka - Test Your Understanding

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

Complete the code to set the Kafka consumer to read messages with at-least-once delivery guarantee.

Kafka
props.put("enable.auto.commit", [1]);
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
C"true"
D"false"
Attempts:
3 left
💡 Hint
Common Mistakes
Using string values instead of boolean
Setting auto commit to true for at-least-once
2fill in blank
medium

Complete the code to configure Kafka producer for exactly-once delivery semantics.

Kafka
props.put("enable.idempotence", [1]);
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
C"true"
D"false"
Attempts:
3 left
💡 Hint
Common Mistakes
Using string instead of boolean
Disabling idempotence for exactly-once
3fill in blank
hard

Fix the error in the code to ensure at-most-once delivery by committing offsets before processing.

Kafka
consumer.commitSync();
processRecord(record);
// This ensures [1] delivery.
Drag options to blanks, or click blank then click option'
Aat-least-once
Bno
Cexactly-once
Dat-most-once
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing at-most-once with at-least-once
Committing after processing instead of before
4fill in blank
hard

Fill both blanks to create a Kafka consumer that disables auto commit and sets max poll records to 10.

Kafka
props.put("enable.auto.commit", [1]);
props.put("max.poll.records", [2]);
Drag options to blanks, or click blank then click option'
Afalse
Btrue
C"10"
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using boolean true for auto commit when disabling
Using 10 as integer instead of "10" string for max poll records
5fill in blank
hard

Fill all three blanks to create a Kafka producer with idempotence enabled, retries set to 5, and acks set to all.

Kafka
props.put("enable.idempotence", [1]);
props.put("retries", [2]);
props.put("acks", [3]);
Drag options to blanks, or click blank then click option'
Afalse
B5
Call
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Setting idempotence to false
Using string instead of integer for retries
Using "\"all\"" with extra quotes for acks