Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DF1C4200D4D for ; Sun, 3 Dec 2017 18:02:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id DD870160C1A; Sun, 3 Dec 2017 17:02:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2EBEE160BF8 for ; Sun, 3 Dec 2017 18:02:06 +0100 (CET) Received: (qmail 21043 invoked by uid 500); 3 Dec 2017 17:02:05 -0000 Mailing-List: contact dev-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list dev@kafka.apache.org Received: (qmail 21032 invoked by uid 99); 3 Dec 2017 17:02:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Dec 2017 17:02:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 102961A010B for ; Sun, 3 Dec 2017 17:02:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id xV286SxFkNeC for ; Sun, 3 Dec 2017 17:02:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 5CB215F589 for ; Sun, 3 Dec 2017 17:02:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id C5B06E0AA3 for ; Sun, 3 Dec 2017 17:02:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id D7A5A255C2 for ; Sun, 3 Dec 2017 17:02:00 +0000 (UTC) Date: Sun, 3 Dec 2017 17:02:00 +0000 (UTC) From: "kic (JIRA)" To: dev@kafka.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (KAFKA-6302) Topic can not be recreated after it is deleted MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 03 Dec 2017 17:02:07 -0000 kic created KAFKA-6302: -------------------------- Summary: Topic can not be recreated after it is deleted Key: KAFKA-6302 URL: https://issues.apache.org/jira/browse/KAFKA-6302 Project: Kafka Issue Type: Bug Components: admin, clients Affects Versions: 1.0.0 Reporter: kic I use an embedded kafka for unit test. My application relies on the ability to recreate topics programmatically. Currently it is not possible to re-create a topic after it has been deleted. {code} // needs compile time depedency 'net.manub:scalatest-embedded-kafka_2.11:1.0.0' package kic.kafka.embedded import java.util.Properties import org.apache.kafka.clients.admin.{AdminClient, NewTopic} import org.scalatest._ import scala.collection.JavaConverters._ class EmbeddedKafaJavaWrapperTest extends FlatSpec with Matchers { val props = new Properties() val testTopic = "test-topic" "A running server" should "return a list of topics" in { props.setProperty("bootstrap.servers", "localhost:10001") props.setProperty("delete.enable.topic", "true") props.setProperty("group.id", "test-client") props.setProperty("key.deserializer", "org.apache.kafka.common.serialization.LongDeserializer") props.setProperty("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer") props.setProperty("clinet.id", "test-client") props.setProperty("key.serializer", "org.apache.kafka.common.serialization.LongSerializer") props.setProperty("value.serializer", "org.apache.kafka.common.serialization.StringSerializer") EmbeddedKafaJavaWrapper.start(10001, 10002, props) try { implicit val admin = AdminClient.create(props) // create topic and confirm it exists createTopic(testTopic) val topics = listTopics() info(s"topics: $topics") topics should contain(testTopic) // now we should be able to send something to this topic // TODO create producer and send something // delete topic deleteTopic(testTopic) listTopics() shouldNot contain(testTopic) // recreate topic createTopic(testTopic) // listTopics() should contain(testTopic) // and finally consume from the topic and expect to get 0 entries // TODO create consumer and poll once } finally { EmbeddedKafaJavaWrapper.stop() } } def listTopics()(implicit admin: AdminClient) = admin.listTopics().names().get() def createTopic(topic: String)(implicit admin: AdminClient) = admin.createTopics(Seq(new NewTopic(topic, 1, 1)).asJava) def deleteTopic(topic: String)(implicit admin: AdminClient) = admin.deleteTopics(Seq("test-topic").asJava).all().get() } {code} Btw, what happens to connected consumers when I delete a topic? -- This message was sent by Atlassian JIRA (v6.4.14#64029)