Alonexc commented on code in PR #3531:
URL: https://github.com/apache/eventmesh/pull/3531#discussion_r1149939581


##########
eventmesh-storage/eventmesh-storage-kafka/src/main/java/org/apache/eventmesh/storage/kafka/producer/ProducerImpl.java:
##########
@@ -90,12 +86,19 @@ public void send(CloudEvent cloudEvent) {
     }
 
     public void checkTopicExist(String topic) throws ExecutionException, 
InterruptedException, StorageConnectorRuntimeException {
-        Admin admin = Admin.create(properties);
-        Set<String> topicNames = admin.listTopics().names().get();
-        admin.close();
-        boolean exist = topicNames.contains(topic);
-        if (!exist) {
-            throw new StorageConnectorRuntimeException(String.format("topic:%s 
is not exist", topic));
+        Admin admin = null;
+        try {

Review Comment:
   It is recommended to use try-with-recourse.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to