This is the code that i can see in CreateTopicCommand
var zkClient: ZkClient = null
try {
zkClient = new ZkClient(zkConnect, 30000, 30000, ZKStringSerializer)
createTopic(zkClient, topic, nPartitions, replicationFactor,
replicaAssignmentStr)
println("creation succeeded!")
} catch {
case e: Throwable =>
println("creation failed because of " + e.getMessage)
println(Utils.stackTrace(e))
} finally {
if (zkClient != null)
zkClient.close()
}
Mine is *ZkClient zkClient = new ZkClient(zookeeperCluster, 30000, 30000);*
Thanks
2014-02-25 17:25 GMT+01:00 Jun Rao <[email protected]>:
> Is the ZK connection string + namespace the same btw the code and the
> script?
>
> Thanks,
>
> Jun
>
>
> On Tue, Feb 25, 2014 at 3:01 AM, David Morales de Frías <
> [email protected]> wrote:
>
> > Hi there,
> >
> > I'm trying to create a topic from java code, by calling
> CreateTopicCommand:
> >
> >
> > *ZkClient zkClient = new ZkClient(zookeeperCluster, 30000, 30000);*
> >
> > *CreateTopicCommand.createTopic(zkClient, topic,
> > numPartitions.intValue(),replicationFactor.intValue(), "");*
> >
> > *zkClient.close();*
> >
> >
> > The program runs without errors and even if i call it twice, the second
> > time i receive an exception telling me that this topic already exists.
> >
> > But, if run a list-topics, the topic doesn't appear... and there is no
> > folder under kafka-logs
> >
> > If i want to create it by using the create-topic script, it prints that
> the
> > topic already exists¡
> >
> > Any idea about that?
> >
> >
> >
> > Regards.
> >
>