You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Sumit Rangwala <su...@gmail.com> on 2015/01/23 21:13:34 UTC

Delete topic API in 0.8.2

I am trying to find if there is a supported API to delete topic (from
within my code) specifically in 0.8.2. One method that I can think of is
calling kafka.admin.TopicCommand.main with the same parameters as one gives
on the command line. Is this the recommended way or is there a better way
of doing it?

Furthermore, are the details of deleting a topic in 0.8.2 documented, since
I would like to understand if delete topic only deletes the topic in
zookeeper or it also cleans the logs in kafka broker as well.


Sumit

Re: Delete topic API in 0.8.2

Posted by Sumit Rangwala <su...@gmail.com>.
Thanks Harsha, exactly what I was looking for.

Sumit


On Fri, Jan 23, 2015 at 12:24 PM, Harsha <ka...@harsha.io> wrote:

> Sumit,
>        You can use AdminUtils.deleteTopic(zkClient, topicName) . This
>        will initiate the deleteTopic process by zookeeper notification
>        to KafkaController.deleteTopicManager.  It deletes log files
>        along with zookeeper topic path as Timothy mentioned.
> -Harsha
>
> On Fri, Jan 23, 2015, at 12:18 PM, Timothy Chen wrote:
> > I believe that's the only way it's supported from the CLI.
> >
> > Delete topic actually fully removes the topic from the cluster, which
> > also includes cleaning the logs and removing it from zookeeper (once
> > it is fully deleted).
> >
> > Tim
> >
> > On Fri, Jan 23, 2015 at 12:13 PM, Sumit Rangwala
> > <su...@gmail.com> wrote:
> > > I am trying to find if there is a supported API to delete topic (from
> > > within my code) specifically in 0.8.2. One method that I can think of
> is
> > > calling kafka.admin.TopicCommand.main with the same parameters as one
> gives
> > > on the command line. Is this the recommended way or is there a better
> way
> > > of doing it?
> > >
> > > Furthermore, are the details of deleting a topic in 0.8.2 documented,
> since
> > > I would like to understand if delete topic only deletes the topic in
> > > zookeeper or it also cleans the logs in kafka broker as well.
> > >
> > >
> > > Sumit
>

Re: Delete topic API in 0.8.2

Posted by Harsha <ka...@harsha.io>.
Sumit,
       You can use AdminUtils.deleteTopic(zkClient, topicName) . This
       will initiate the deleteTopic process by zookeeper notification
       to KafkaController.deleteTopicManager.  It deletes log files
       along with zookeeper topic path as Timothy mentioned.
-Harsha

On Fri, Jan 23, 2015, at 12:18 PM, Timothy Chen wrote:
> I believe that's the only way it's supported from the CLI.
> 
> Delete topic actually fully removes the topic from the cluster, which
> also includes cleaning the logs and removing it from zookeeper (once
> it is fully deleted).
> 
> Tim
> 
> On Fri, Jan 23, 2015 at 12:13 PM, Sumit Rangwala
> <su...@gmail.com> wrote:
> > I am trying to find if there is a supported API to delete topic (from
> > within my code) specifically in 0.8.2. One method that I can think of is
> > calling kafka.admin.TopicCommand.main with the same parameters as one gives
> > on the command line. Is this the recommended way or is there a better way
> > of doing it?
> >
> > Furthermore, are the details of deleting a topic in 0.8.2 documented, since
> > I would like to understand if delete topic only deletes the topic in
> > zookeeper or it also cleans the logs in kafka broker as well.
> >
> >
> > Sumit

Re: Delete topic API in 0.8.2

Posted by Timothy Chen <tn...@gmail.com>.
I believe that's the only way it's supported from the CLI.

Delete topic actually fully removes the topic from the cluster, which
also includes cleaning the logs and removing it from zookeeper (once
it is fully deleted).

Tim

On Fri, Jan 23, 2015 at 12:13 PM, Sumit Rangwala
<su...@gmail.com> wrote:
> I am trying to find if there is a supported API to delete topic (from
> within my code) specifically in 0.8.2. One method that I can think of is
> calling kafka.admin.TopicCommand.main with the same parameters as one gives
> on the command line. Is this the recommended way or is there a better way
> of doing it?
>
> Furthermore, are the details of deleting a topic in 0.8.2 documented, since
> I would like to understand if delete topic only deletes the topic in
> zookeeper or it also cleans the logs in kafka broker as well.
>
>
> Sumit