dingshuangxi888 commented on a change in pull request #3149:
URL: https://github.com/apache/rocketmq/pull/3149#discussion_r716214481
##########
File path:
tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java
##########
@@ -955,12 +973,49 @@ public SubscriptionGroupWrapper
getAllSubscriptionGroup(final String brokerAddr,
}
@Override
- public TopicConfigSerializeWrapper getAllTopicGroup(final String
brokerAddr,
+ public SubscriptionGroupWrapper getUserSubscriptionGroup(final String
brokerAddr,
+ long timeoutMillis) throws InterruptedException,
+ RemotingTimeoutException, RemotingSendRequestException,
RemotingConnectException, MQBrokerException {
+ SubscriptionGroupWrapper subscriptionGroupWrapper =
this.mqClientInstance.getMQClientAPIImpl()
+ .getAllSubscriptionGroup(brokerAddr, timeoutMillis);
+
+ Iterator<Entry<String, SubscriptionGroupConfig>> iterator =
subscriptionGroupWrapper.getSubscriptionGroupTable()
+ .entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry<String, SubscriptionGroupConfig> configEntry =
iterator.next();
+ if (MixAll.isSysConsumerGroup(configEntry.getKey()) ||
SYSTEM_GROUP_SET.contains(configEntry.getKey())) {
+ iterator.remove();
+ }
+ }
+
+ return subscriptionGroupWrapper;
+ }
+
+ @Override
+ public TopicConfigSerializeWrapper getAllTopicConfig(final String
brokerAddr,
long timeoutMillis) throws InterruptedException,
RemotingTimeoutException, RemotingSendRequestException,
RemotingConnectException, MQBrokerException {
return
this.mqClientInstance.getMQClientAPIImpl().getAllTopicConfig(brokerAddr,
timeoutMillis);
}
+ @Override
+ public TopicConfigSerializeWrapper getUserTopicConfig(final String
brokerAddr, final boolean specialTopic,
+ long timeoutMillis) throws InterruptedException, RemotingException,
+ MQBrokerException, MQClientException {
+ TopicConfigSerializeWrapper topicConfigSerializeWrapper =
this.getAllTopicConfig(brokerAddr, timeoutMillis);
+ TopicList topicList =
this.mqClientInstance.getMQClientAPIImpl().getSystemTopicListFromBroker(brokerAddr,
+ timeoutMillis);
+ Iterator<Entry<String, TopicConfig>> iterator =
topicConfigSerializeWrapper.getTopicConfigTable().entrySet()
+ .iterator();
+ while (iterator.hasNext()) {
+ String topic = iterator.next().getKey();
+ if (topicList.getTopicList().contains(topic) || !specialTopic &&
(topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX) ||
topic.startsWith(MixAll.DLQ_GROUP_TOPIC_PREFIX))) {
Review comment:
嗯嗯,逻辑清晰一点,未来加个条件也不会出bug
--
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]