mistyzyq opened a new issue, #3248:
URL: https://github.com/apache/incubator-eventmesh/issues/3248

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Environment
   
   Windows
   
   ### EventMesh version
   
   master
   
   ### What happened
   
   The RocketMQAdmin#getTopic method can only be called once, all subsequent 
calls will get this error:
   org.apache.rocketmq.client.exception.MQClientException: The AdminExt service 
state not OK, maybe started once, SHUTDOWN_ALREADY\nSee 
http://rocketmq.apache.org/docs/faq/ for further details.
   
   I read the source code cursoryly, in RocketMQAdmin.java, in the follow code, 
the _adminExt_ saves it's state and can only be _start_ once, but here we 
_start_ and _shutdown_ every time.
   ```
       @Override
       public List<TopicProperties> getTopic() throws Exception {
           try {
               adminExt.start();
               List<TopicProperties> result = new ArrayList<>();
   
               Set<String> topicList = 
adminExt.fetchAllTopicList().getTopicList();
               for (String topic : topicList) {
                   long messageCount = 0;
                   TopicStatsTable topicStats = 
adminExt.examineTopicStats(topic);
                   HashMap<MessageQueue, TopicOffset> offsetTable = 
topicStats.getOffsetTable();
                   for (TopicOffset topicOffset : offsetTable.values()) {
                       messageCount += topicOffset.getMaxOffset() - 
topicOffset.getMinOffset();
                   }
                   result.add(new TopicProperties(
                       topic, messageCount
                   ));
               }
   
               result.sort(Comparator.comparing(t -> t.name));
               return result;
           } finally {
               adminExt.shutdown();
           }
       }
   ```
   
   ### How to reproduce
   
   1. startup eventmesh-runtime, and run dashboard
   2. open dashboard page in brower, and click the Topic menu, the page url is: 
http://localhost:3000/topic
   3. an red error toast shows: Failed to fetch the list of topics \ Unable to 
connect to the EventMesh daemon
   
   ### Debug logs
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!


-- 
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