Umesh, That is a Kafka broker level config/parameter and not part of the producer.
Jayesh On 9/22/16, 3:09 AM, "UMESH CHAUDHARY" <umesh9...@gmail.com> wrote: Hi Mates, I was trying to understand that if auto.create.topics.enable=true then how KafkaProducer first creates the topic and sends messages to it. What I saw: private Future<RecordMetadata> doSend(ProducerRecord<K, V> record, Callback callback) method in KafkaProducer.java. What I failed to get: When getting metadata for topic using ClusterAndWaitTime clusterAndWaitTime = waitOnMetadata(record.topic(), this.maxBlockTimeMs); line, I am failed to locate the path where we don't have any metadata for the topic i.e. topic doesn't exist and according to "auto.create.topics.enable=true" KafkaProducer invokes createTopic before sending the record. It works flawlessly with clients so it must be coded somewhere. I also saw MockProducerTest.java but unable to locate. I am a newbie so please forgive for any stupidity here. Regards, Umesh