kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Morales de Frías <dmora...@paradigmatecnologico.com>
Subject Re: calling ad-hoc topic creation from code
Date Tue, 25 Feb 2014 16:39:28 GMT
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 <junrao@gmail.com>:

> 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 <
> dmorales@paradigmatecnologico.com> 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.
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message