0
0
Kafkadevops~10 mins

Exactly-once semantics (EOS) 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 enable exactly-once semantics in Kafka producer configuration.

Kafka
Properties props = new Properties();
props.put("enable.idempotence", [1]);
Drag options to blanks, or click blank then click option'
A"maybe"
B"false"
C"yes"
D"true"
Attempts:
3 left
💡 Hint
Common Mistakes
Using false disables idempotence, so exactly-once is not guaranteed.
Using invalid strings causes configuration errors.
2fill in blank
medium

Complete the code to set the transaction ID for Kafka producer to support EOS.

Kafka
props.put("transactional.id", [1]);
Drag options to blanks, or click blank then click option'
A"txn-123"
Bnull
C""
D123
Attempts:
3 left
💡 Hint
Common Mistakes
Setting transactional.id to null disables transactions.
Using empty string disables transactions.
3fill in blank
hard

Fix the error in the code to begin a Kafka transaction correctly.

Kafka
producer.[1]();
Drag options to blanks, or click blank then click option'
AbeginTransaction
BstartTransaction
CinitTransaction
DopenTransaction
Attempts:
3 left
💡 Hint
Common Mistakes
Using startTransaction causes a compilation error.
initTransaction and openTransaction do not exist.
4fill in blank
hard

Fill both blanks to commit a Kafka transaction and close the producer.

Kafka
producer.[1]();
producer.[2]();
Drag options to blanks, or click blank then click option'
AcommitTransaction
Bclose
Cflush
DabortTransaction
Attempts:
3 left
💡 Hint
Common Mistakes
Calling abortTransaction instead of commitTransaction.
Closing producer before committing transaction.
5fill in blank
hard

Fill all three blanks to configure Kafka consumer for exactly-once semantics with isolation level and auto commit disabled.

Kafka
props.put("isolation.level", [1]);
props.put("enable.auto.commit", [2]);
props.put("auto.offset.reset", [3]);
Drag options to blanks, or click blank then click option'
A"read_committed"
B"false"
C"earliest"
D"true"
Attempts:
3 left
💡 Hint
Common Mistakes
Setting isolation.level to 'read_uncommitted' breaks EOS.
Enabling auto commit causes duplicate processing.
Using 'latest' for auto.offset.reset may skip messages.