Creating a Kafka topic results in no leader
<p>I am using Kafka v0.9.0.1 (Scala v2.11) and the <code>com.101tec:zkclient</code> v0.7. I am trying to use <code>AdminUtils</code> to create a kafka topic. My code is the following.</p>

<pre class="lang-java prettyprint-override"><code>String zkServers = "node1:2181,node2:2181,node3:2181,node4:2181";
Integer sessionTimeout = (int)TimeUnit.SECONDS.toMillis(10L);
Integer connectionTimeout = (int)TimeUnit.SECONDS.toMillis(8L);
ZkSerializer zkSerializer = ZKStringSerializer$.MODULE$;
Boolean isSecureKafkaCluster = false;
String topic = "test";
Integer partitions = 1;
Integer replication = 3;

ZkClient zkClient = new ZkClient(zkServers, sessionTimeout, connectionTimeout, zkSerializer);
ZkUtils zkUtils = new ZkUtils(zkClient, new ZkConnection(zkServers), isSecureKafkaCluster)
if(!AdminUtils.topicExists(zkUtils, topic)) {
 AdminUtils.createTopic(zkUtils, topic, partitions, replications, new Properties());
}
</code></pre>

<p>The topic is actually created as verified by the following command.</p>

<pre><code>bin/kafka-topics.sh --describe --zookeeper node1:2181 --topic test
</code></pre>

<p>However, the output is not as expected.</p>

<pre>
Topic:test  PartitionCount:1    ReplicationFactor:1 Configs:
Topic: test Partition: 0    Leader: -1  Replicas: 4 Isr: 
</pre>

<p>If I use the script.</p>

<pre><code>bin/kafka-topics.sh --create --zookeeper node1:2181 --replication-factor 3 --partitions 1 --topic topic1
</code></pre>

<p>Then I see the following.</p>

<pre><code>Topic:test1 PartitionCount:1    ReplicationFactor:3 Configs:
Topic: test1    Partition: 0    Leader: 2   Replicas: 2,3,4 Isr: 2
</code></pre>

<p>Any ideas on what I'm doing wrong? The effect is that if I use a <code>Producer</code> to send a <code>ProducerRecord</code> to the topic, nothing shows up on the topic. </p>