You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2021/01/15 14:30:19 UTC

[camel-kafka-connector] branch master updated: (chores) Cleanup topic deletion code and allow public access to the admin client

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git


The following commit(s) were added to refs/heads/master by this push:
     new ce6cbb3  (chores) Cleanup topic deletion code and allow public access to the admin client
ce6cbb3 is described below

commit ce6cbb353c6143005451a83a8f286b37cd831a05
Author: Otavio Rodolfo Piske <op...@redhat.com>
AuthorDate: Fri Jan 15 14:47:10 2021 +0100

    (chores) Cleanup topic deletion code and allow public access to the admin client
---
 .../kafkaconnector/common/clients/kafka/KafkaClient.java      | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/clients/kafka/KafkaClient.java b/tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/clients/kafka/KafkaClient.java
index 4830843..4e33566 100644
--- a/tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/clients/kafka/KafkaClient.java
+++ b/tests/itests-common/src/test/java/org/apache/camel/kafkaconnector/common/clients/kafka/KafkaClient.java
@@ -20,7 +20,6 @@ package org.apache.camel.kafkaconnector.common.clients.kafka;
 import java.time.Duration;
 import java.util.Collections;
 import java.util.Map;
-import java.util.Properties;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.function.Consumer;
@@ -156,14 +155,18 @@ public class KafkaClient<K, V> {
         future.get();
     }
 
+    public AdminClient getAdminClient() {
+        return AdminClient.create(producerPropertyFactory.getProperties());
+    }
+
     /**
      * Delete a topic
      *
      * @param topic the topic to be deleted
      */
     public void deleteTopic(String topic) {
-        Properties props = producerPropertyFactory.getProperties();
-        AdminClient admClient = AdminClient.create(props);
-        admClient.deleteTopics(Collections.singleton(topic));
+        AdminClient adminClient = getAdminClient();
+
+        adminClient.deleteTopics(Collections.singleton(topic));
     }
 }