Re: How to create a topic using the Java API / Client?
I'm guessing its not possible to delete topics? On Thu, Sep 15, 2016 at 5:43 AM, Ali Akhtarwrote: > Thank you Martin > > On 15 Sep 2016 3:05 am, "Mathieu Fenniak" > wrote: > >> Hey Ali, >> >> If you have auto create turned on, which it sounds like you do, and you're >> happy with using the broker's configured partition count and replication >> factor, then you can call "partitionsFor(String topic)" on your producer. >> This will create the topic without sending a message to it. I'm not sure >> it's 100% smart, but I found it to be better than the alternatives I could >> find. :-) >> >> Mathieu >> >> >> On Wed, Sep 14, 2016 at 3:41 PM, Ali Akhtar wrote: >> >> > It looks like if I just send a message to a non-existent topic, it is >> > created. But this has the downside that the first message of the topic >> is >> > null or otherwise invalid. >> > >> > Also the partition count can't be specified. >> > >> > Is there a way to create a topic without needing to post a null >> message? Do >> > I need to talk to the bash script? >> > >> > On Wed, Sep 14, 2016 at 8:45 AM, Ali Akhtar >> wrote: >> > >> > > Using version 0.10.0.1, how can I create kafka topics using the java >> > > client / API? >> > > >> > > Stackoverflow answers describe using kafka.admin.AdminUtils, but this >> > > class is not included in the kafka-clients maven dependency. I also >> don't >> > > see the package kafka.admin in the javadocs: http://kafka.apache. >> > > org/0100/javadoc/index.html?org/apache/kafka/clients/produce >> > > r/KafkaProducer.html >> > > >> > > >> > > What am I missing? >> > > >> > > >> > >> >
Re: How to create a topic using the Java API / Client?
Thank you Martin On 15 Sep 2016 3:05 am, "Mathieu Fenniak"wrote: > Hey Ali, > > If you have auto create turned on, which it sounds like you do, and you're > happy with using the broker's configured partition count and replication > factor, then you can call "partitionsFor(String topic)" on your producer. > This will create the topic without sending a message to it. I'm not sure > it's 100% smart, but I found it to be better than the alternatives I could > find. :-) > > Mathieu > > > On Wed, Sep 14, 2016 at 3:41 PM, Ali Akhtar wrote: > > > It looks like if I just send a message to a non-existent topic, it is > > created. But this has the downside that the first message of the topic is > > null or otherwise invalid. > > > > Also the partition count can't be specified. > > > > Is there a way to create a topic without needing to post a null message? > Do > > I need to talk to the bash script? > > > > On Wed, Sep 14, 2016 at 8:45 AM, Ali Akhtar > wrote: > > > > > Using version 0.10.0.1, how can I create kafka topics using the java > > > client / API? > > > > > > Stackoverflow answers describe using kafka.admin.AdminUtils, but this > > > class is not included in the kafka-clients maven dependency. I also > don't > > > see the package kafka.admin in the javadocs: http://kafka.apache. > > > org/0100/javadoc/index.html?org/apache/kafka/clients/produce > > > r/KafkaProducer.html > > > > > > > > > What am I missing? > > > > > > > > >
Re: How to create a topic using the Java API / Client?
Hey Ali, If you have auto create turned on, which it sounds like you do, and you're happy with using the broker's configured partition count and replication factor, then you can call "partitionsFor(String topic)" on your producer. This will create the topic without sending a message to it. I'm not sure it's 100% smart, but I found it to be better than the alternatives I could find. :-) Mathieu On Wed, Sep 14, 2016 at 3:41 PM, Ali Akhtarwrote: > It looks like if I just send a message to a non-existent topic, it is > created. But this has the downside that the first message of the topic is > null or otherwise invalid. > > Also the partition count can't be specified. > > Is there a way to create a topic without needing to post a null message? Do > I need to talk to the bash script? > > On Wed, Sep 14, 2016 at 8:45 AM, Ali Akhtar wrote: > > > Using version 0.10.0.1, how can I create kafka topics using the java > > client / API? > > > > Stackoverflow answers describe using kafka.admin.AdminUtils, but this > > class is not included in the kafka-clients maven dependency. I also don't > > see the package kafka.admin in the javadocs: http://kafka.apache. > > org/0100/javadoc/index.html?org/apache/kafka/clients/produce > > r/KafkaProducer.html > > > > > > What am I missing? > > > > >
Re: How to create a topic using the Java API / Client?
You can make following setting to set partition count, etc auto.create.topics.enable = true(enable auto creation of topic on the server) num.partitions = 1 (number of log partitions per topic) On 9/14/16, 2:41 PM, "Ali Akhtar"wrote: It looks like if I just send a message to a non-existent topic, it is created. But this has the downside that the first message of the topic is null or otherwise invalid. Also the partition count can't be specified. Is there a way to create a topic without needing to post a null message? Do I need to talk to the bash script? On Wed, Sep 14, 2016 at 8:45 AM, Ali Akhtar wrote: > Using version 0.10.0.1, how can I create kafka topics using the java > client / API? > > Stackoverflow answers describe using kafka.admin.AdminUtils, but this > class is not included in the kafka-clients maven dependency. I also don't > see the package kafka.admin in the javadocs: http://kafka.apache. > org/0100/javadoc/index.html?org/apache/kafka/clients/produce > r/KafkaProducer.html > > > What am I missing? > >
Re: How to create a topic using the Java API / Client?
It looks like if I just send a message to a non-existent topic, it is created. But this has the downside that the first message of the topic is null or otherwise invalid. Also the partition count can't be specified. Is there a way to create a topic without needing to post a null message? Do I need to talk to the bash script? On Wed, Sep 14, 2016 at 8:45 AM, Ali Akhtarwrote: > Using version 0.10.0.1, how can I create kafka topics using the java > client / API? > > Stackoverflow answers describe using kafka.admin.AdminUtils, but this > class is not included in the kafka-clients maven dependency. I also don't > see the package kafka.admin in the javadocs: http://kafka.apache. > org/0100/javadoc/index.html?org/apache/kafka/clients/produce > r/KafkaProducer.html > > > What am I missing? > >
How to create a topic using the Java API / Client?
Using version 0.10.0.1, how can I create kafka topics using the java client / API? Stackoverflow answers describe using kafka.admin.AdminUtils, but this class is not included in the kafka-clients maven dependency. I also don't see the package kafka.admin in the javadocs: http://kafka.apache. org/0100/javadoc/index.html?org/apache/kafka/clients/ producer/KafkaProducer.html What am I missing?