Complete the code to set the topic cleanup policy to log compaction.
props.put("cleanup.policy", "[1]");
Setting cleanup.policy to compact enables log compaction for the topic.
Complete the code to create a compacted topic named 'user-updates'.
bin/kafka-topics.sh --create --topic user-updates --partitions 3 --replication-factor 1 --config cleanup.policy=[1] --bootstrap-server localhost:9092
The cleanup.policy=compact config enables log compaction on the topic.
Fix the error in the code to configure log compaction for an existing topic.
bin/kafka-configs.sh --alter --entity-type topics --entity-name user-logs --add-config cleanup.policy=[1] --bootstrap-server localhost:9092
To enable log compaction, the cleanup.policy must be set to 'compact'.
Fill both blanks to create a compacted topic with 4 partitions and replication factor 2.
bin/kafka-topics.sh --create --topic logs --partitions [1] --replication-factor [2] --config cleanup.policy=compact --bootstrap-server localhost:9092
The topic is created with 4 partitions and replication factor 2 to ensure scalability and fault tolerance.
Fill all three blanks to configure a producer to enable idempotence and set retries to 5.
props.put("enable.idempotence", [1]); props.put("acks", "[2]"); props.put("retries", [3]);
Enabling idempotence (true) with acks=all and retries set to 5 ensures safe and reliable message delivery, which complements log compaction.