jianyun8023 commented on a change in pull request #7968:
URL: https://github.com/apache/pulsar/pull/7968#discussion_r484028923



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -2417,6 +2417,53 @@ protected void internalGetMaxProducers(AsyncResponse 
asyncResponse) {
         return 
pulsar().getTopicPoliciesService().updateTopicPoliciesAsync(topicName, 
topicPolicies.get());
     }
 
+    protected void internalGetMaxConsumers(AsyncResponse asyncResponse) {
+        validateAdminAccessForTenant(namespaceName.getTenant());
+        validatePoliciesReadOnlyAccess();
+        if (topicName.isGlobal()) {
+            validateGlobalNamespaceOwnership(namespaceName);
+        }
+        checkTopicLevelPolicyEnable();
+        Optional<Integer> maxConsumers = getTopicPolicies(topicName)
+                .map(TopicPolicies::getMaxConsumerPerTopic);
+        if (!maxConsumers.isPresent()) {
+            asyncResponse.resume(Response.noContent().build());
+        } else {
+            asyncResponse.resume(maxConsumers.get());
+        }
+    }

Review comment:
       I think the new code can comply with this rule.




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

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


Reply via email to