You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by chinchu chinchu <ch...@gmail.com> on 2018/07/10 16:05:45 UTC

Create a Topic if Not Exists

Hi All,
I am looking for  a way to script(bash)  kafka topic creation . We have
around 30 to 40 topics that  need to be created on different envs . The
intention is to make this process automated ,so looking for something like
'create topic if not exists' or similar  by looking at a return code . Does
something like this exist today ?.

Thanks,
Chinchu

Re: Create a Topic if Not Exists

Posted by Andrew Clarkson <an...@rallyhealth.com>.
Hey Chinchu,

There's a --if-not-exists option on the kafka-topics script in the
confluent platform.

Here's the docs from confluent-3.0.0/bin/kafka-topics --help:

--if-not-exists                          if set when creating topics, the
                                           action will only execute if the
                                           topic does not already exist

Let me know if that works for you.

Best,
Andrew

On Tue, Jul 10, 2018 at 1:48 PM, Paolo Patierno <pp...@live.com> wrote:

> The properties Dan is referring are
>
> auto.create.topics.enable
>
> which is true by default and
>
> num.partitions
>
> which is 1 by default.
> They are both configuration parameters for the broker.
>
> Thanks
> Paolo
>
> Get Outlook for Android<https://aka.ms/ghei36>
>
>
>
> From: Dan Rosanova
> Sent: Tuesday, 10 July, 20:39
> Subject: RE: Create a Topic if Not Exists
> To: users@kafka.apache.org
>
>
> Hi Chinchu, I thought the default behavior of Kafka was to create topics
> if you send to them and they don't exist. I could be wrong. We had to
> support that in one of our products, so I am pretty sure that's the
> default. You do need to be mindful of the default partition count though,
> which I think is one. Kind Regards, -Dan -----Original Message----- From:
> chinchu chinchu Sent: Tuesday, July 10, 2018 9:06 AM To:
> users@kafka.apache.org Subject: Create a Topic if Not Exists Hi All, I am
> looking for a way to script(bash) kafka topic creation . We have around 30
> to 40 topics that need to be created on different envs . The intention is
> to make this process automated ,so looking for something like 'create topic
> if not exists' or similar by looking at a return code . Does something like
> this exist today ?. Thanks, Chinchu
>
>

Re: Create a Topic if Not Exists

Posted by Paolo Patierno <pp...@live.com>.
The properties Dan is referring are

auto.create.topics.enable

which is true by default and

num.partitions

which is 1 by default.
They are both configuration parameters for the broker.

Thanks
Paolo

Get Outlook for Android<https://aka.ms/ghei36>



From: Dan Rosanova
Sent: Tuesday, 10 July, 20:39
Subject: RE: Create a Topic if Not Exists
To: users@kafka.apache.org


Hi Chinchu, I thought the default behavior of Kafka was to create topics if you send to them and they don't exist. I could be wrong. We had to support that in one of our products, so I am pretty sure that's the default. You do need to be mindful of the default partition count though, which I think is one. Kind Regards, -Dan -----Original Message----- From: chinchu chinchu Sent: Tuesday, July 10, 2018 9:06 AM To: users@kafka.apache.org Subject: Create a Topic if Not Exists Hi All, I am looking for a way to script(bash) kafka topic creation . We have around 30 to 40 topics that need to be created on different envs . The intention is to make this process automated ,so looking for something like 'create topic if not exists' or similar by looking at a return code . Does something like this exist today ?. Thanks, Chinchu


RE: Create a Topic if Not Exists

Posted by Dan Rosanova <da...@microsoft.com.INVALID>.
Hi Chinchu,
I thought the default behavior of Kafka was to create topics if you send to them and they don't exist. I could be wrong. We had to support that in one of our products, so I am pretty sure that's the default. You do need to be mindful of the default partition count though, which I think is one. 

Kind Regards,
-Dan

-----Original Message-----
From: chinchu chinchu <ch...@gmail.com> 
Sent: Tuesday, July 10, 2018 9:06 AM
To: users@kafka.apache.org
Subject: Create a Topic if Not Exists

Hi All,
I am looking for  a way to script(bash)  kafka topic creation . We have around 30 to 40 topics that  need to be created on different envs . The intention is to make this process automated ,so looking for something like 'create topic if not exists' or similar  by looking at a return code . Does something like this exist today ?.

Thanks,
Chinchu