I am new to Kafka and working with new KafkaProducer and KafkaConsumer, version : 0.9.0.1
Is there any way in java to alter/update the number of partitions for a specific topic after it has been created.
I am not using zookeeper to create topic. My KafkaProducer is automatically creating topics when publish request arrives.
I can also provide more details if these are not enough
Yes, it's possible. You have to access the
AdminUtils
scala class inkafka_2.11-0.9.0.1.jar
to add partitions.AdminUtils
supports the number of partitions in the topic can only be increased. You may needkafka_2.11-0.9.0.1.jar
,zk-client-0.8.jar
,scala-library-2.11.8.jar
andscala-parser-combinators_2.11-1.0.4.jar
jars in your classpath.Portions of the below code is borrowed / inspired from kafka-cloudera examples.