Complete the code to set the batch size for the Kafka producer.
props.put("batch.size", [1]);
The batch.size property controls the batch size in bytes. Setting it to 16384 (16 KB) is a common default for better throughput.
Complete the code to set linger.ms to delay sending messages for batching.
props.put("linger.ms", [1]);
Setting linger.ms to 5 milliseconds allows the producer to wait briefly to batch more messages, improving throughput.
Fix the error in setting compression.type to improve throughput.
props.put("compression.type", [1]);
The compression.type property expects a string value. Using "gzip" enables gzip compression, which can improve throughput by reducing message size.
Fill both blanks to create a producer config that sets max.in.flight.requests.per.connection and enables idempotence.
props.put("max.in.flight.requests.per.connection", [1]); props.put("enable.idempotence", [2]);
Setting max.in.flight.requests.per.connection to 5 allows multiple requests in flight, and enable.idempotence to "true" ensures exactly-once delivery.
Fill all three blanks to configure retries, acks, and request.timeout.ms for better throughput and reliability.
props.put("retries", [1]); props.put("acks", [2]); props.put("request.timeout.ms", [3]);
Setting retries to 3 allows retrying failed sends, acks to "all" waits for all replicas, and request.timeout.ms to 30000 ms sets a 30-second timeout for requests.