Write a new Kafka application PartitionerDemo
(using Kafka Producer API) as follows:
Partitioner
Partitioner.partition
method)partition
methodPartitioner
using ProducerConfig.PARTITIONER_CLASS_CONFIG propertyCallback
input object (to Producer.send
) and display the partition IDkafka-console-consumer
as many partitions are in usekafka-console-consumer
with --property print.key=true
to print keysProducer.send
kafka-topics --alter
to increase the number of partitions and observe how Cluster
reflects the change
./bin/kafka-topics.sh --zookeeper :2181 --alter --topic PartitionerDemo-input --partitions 3
Duration: 30 mins