You need to pass in the topic name as well. It's better to use AdminUtils.createTopic() to create the topic.
Thanks, Jun On Fri, Oct 17, 2014 at 4:43 PM, Pradeep Badiger <pradeepbadi...@fico.com> wrote: > Hi, > > > > We have issues in getting the topic metadata created when we use the > TopicCommand.createTopic() API. > > > > We have the following configurations > > Red Hat Linux 6.2, Kernel 2.6.32-431.eI6.x86_64 on an x86_64 > > 2 GB RAM > > 2 Core CPU. > > > > Following are the steps and results for the exception that we encountered. > > > > 1. We created the topic using TopicCommand.createTopic() and it > returned without any issues. > > 2. The producer is trying to add the data to the topic. > > 3. The producer fails with an exception > > *k.p.BrokerPartitionInfo - Error while fetching metadata [* > > *{TopicMetadata for topic tloader1 -> No partition metadata for topic > tloader1 due to kafka.common.UnknownTopicOrPartitionException}* > > *] for topic [tloader1]: class > kafka.common.UnknownTopicOrPartitionException* > > 4. We checked the log directory of kafka and we don’t see the folder > for the topic that we tried to create. > > 5. We can list the topic using the list command on the terminal. > > 6. We checked the zookeeper and we don’t see the sub-nodes for the > partitions under topic. > > > > We haven’t seen this happening always. We use the default configurations > for Kafka except we overridden the auto creation of topics. Attached are > the zookeeper and kafka configurations. > > > > We pass the following in the arguments > > replication-factor : 1 > > partition : 1 > > > > zkClient = *new* ZkClient(zookeeperHost, Integer.*valueOf*(sessionTimeoutMs), > Integer.*valueOf*(connectionTimeoutMs), *MODULE$*); > > TopicCommand.*createTopic*(zkClient, *new* > TopicCommandOptions(arguments)); > > > > Thanks, > Pradeep V.B. > > This email and any files transmitted with it are confidential, proprietary > and intended solely for the individual or entity to whom they are > addressed. If you have received this email in error please delete it > immediately. >