Complete the code to set the Kafka producer compression type to gzip.
props.put("compression.type", "[1]");
Setting compression.type to gzip enables gzip compression for Kafka producer messages.
Complete the code to configure the Kafka producer to compress messages with snappy.
props.put("compression.type", "[1]");
Setting compression.type to snappy tells Kafka to use Snappy compression for messages.
Fix the error in the code to enable lz4 compression for Kafka producer.
props.put("compression.type", "[1]");
The correct string for LZ4 compression in Kafka is lz4. Other variants are invalid.
Fill both blanks to create a Kafka producer configuration that uses gzip compression and sets the batch size to 16384 bytes.
props.put("compression.type", "[1]"); props.put("batch.size", [2]);
Setting compression.type to gzip enables gzip compression. The batch.size property controls the batch size in bytes, here set to 16384.
Fill all three blanks to create a Kafka producer configuration that uses lz4 compression, sets batch.size to 50000, and enables idempotence.
props.put("compression.type", "[1]"); props.put("batch.size", [2]); props.put("enable.idempotence", [3]);
Using lz4 for compression, setting batch.size to 50000 bytes, and enabling idempotence with true configures the producer accordingly.