title: Error creating Kafka topic :- replication factor larger than available brokers
body: <p>I am trying to create a kafka topic via     AdminCommand     using below code <a href="https://stackoverflow.com/a/23360100/1069073">Source</a></p>
  
  <pre><code> ZkClient zkClient = new ZkClient(kafkaHost, 10000, 10000, ZKStringSerializer$.MODULE$);
      AdminUtils.createTopic(zkClient, "pa_reliancepoc_telecom_usageevent", 10, 2, new Properties());
  </code></pre>
  
  <p>But getting the below exception</p>
  
  <pre><code>Exception in thread "main" kafka.admin.AdminOperationException: replication factor: 1 larger than available brokers: 0
  at kafka.admin.AdminUtils$.assignReplicasToBrokers(AdminUtils.scala:70)
  at kafka.admin.AdminUtils$.createTopic(AdminUtils.scala:155)
  </code></pre>
  
  <p>However, I am able to create the topic using shell command .</p>