The num.partitions parameter is a server/broker config but you are using it as a client/producer parameter so it will not work and will be ignored.
http://stackoverflow.com/questions/22152269/how-to-specify-number-of-partitions-on-kafka-2-8 I assume the CLI command you are using is the administrative kafka-topics.sh tool which talks directly to zookeeper and the Kafka brokers to create or modify topics in the Kafka cluster. This will work to create a topic before you start your producer app. -hans > On Mar 26, 2017, at 2:00 AM, Laxmi Narayan <nit.dgp...@gmail.com> wrote: > > Hi , > Kafka not accepting number of partitions from config , while from CLI it is > accepting. > > What am I missing here ? > > > props.put("bootstrap.servers", kafkaConstants.Bootstrap_Servers); > props.put("enable.auto.commit", kafkaConstants.Enable_Auto_Commit); > props.put("auto.commit.interval.ms", > kafkaConstants.Auto_Commit_Interval_Ms); > props.put("session.timeout.ms", kafkaConstants.Session_Timeout_Ms); > props.put("linger.ms", "1"); > > props.put("key.deserializer", kafkaConstants.Key_Deserializer); > props.put("value.deserializer", kafkaConstants.Value_Deserializer); > > props.put("key.serializer", kafkaConstants.Key_Serializer); > props.put("value.serializer", kafkaConstants.Value_Serializer); > > props.put("partitioner.class", kafkaConstants.Partitioner_Class); > props.put("num.partitions", 999); > props.put("group.id", kafkaConstants.KafkaGroupId); > > > > > > > Keep learning keep moving .....