Complete the code to enable exactly-once semantics in Kafka producer configuration.
Properties props = new Properties(); props.put("enable.idempotence", [1]);
Setting enable.idempotence to true enables exactly-once semantics in Kafka producer.
Complete the code to set the transaction ID for Kafka producer to support EOS.
props.put("transactional.id", [1]);
The transactional.id must be a unique string to enable transactions for exactly-once semantics.
Fix the error in the code to begin a Kafka transaction correctly.
producer.[1]();The correct method to start a transaction in Kafka producer is beginTransaction().
Fill both blanks to commit a Kafka transaction and close the producer.
producer.[1](); producer.[2]();
First commit the transaction with commitTransaction(), then close the producer with close().
Fill all three blanks to configure Kafka consumer for exactly-once semantics with isolation level and auto commit disabled.
props.put("isolation.level", [1]); props.put("enable.auto.commit", [2]); props.put("auto.offset.reset", [3]);
To ensure exactly-once semantics, set isolation.level to read_committed, disable auto commit by setting enable.auto.commit to false, and set auto.offset.reset to earliest to read from the beginning if no offset is found.