Complete the code to set the Kafka consumer to read messages with at-least-once delivery guarantee.
props.put("enable.auto.commit", [1]);
Setting enable.auto.commit to false ensures manual commit, enabling at-least-once delivery.
Complete the code to configure Kafka producer for exactly-once delivery semantics.
props.put("enable.idempotence", [1]);
Setting enable.idempotence to true enables exactly-once delivery by avoiding duplicate messages.
Fix the error in the code to ensure at-most-once delivery by committing offsets before processing.
consumer.commitSync();
processRecord(record);
// This ensures [1] delivery.Committing offsets before processing means messages might be lost if processing fails, ensuring at-most-once delivery.
Fill both blanks to create a Kafka consumer that disables auto commit and sets max poll records to 10.
props.put("enable.auto.commit", [1]); props.put("max.poll.records", [2]);
Disabling auto commit requires false. max.poll.records expects a string value like "10".
Fill all three blanks to create a Kafka producer with idempotence enabled, retries set to 5, and acks set to all.
props.put("enable.idempotence", [1]); props.put("retries", [2]); props.put("acks", [3]);
Idempotence must be true to avoid duplicates. Retries is an integer 5. Acks set to all waits for all replicas.