You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@eventmesh.apache.org by "Alonexc (via GitHub)" <gi...@apache.org> on 2023/03/28 01:42:16 UTC

[GitHub] [eventmesh] Alonexc commented on a diff in pull request #3531: [ISSUE #3530]Optimize ProducerImpl in evetmesh-storage-kafka module

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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org