Repository navigation
[Issue 7759] Support set Max Consumer on topic level. - #7968
Conversation
|
/pulsarbot run-failure-checks |
|
@codelipenghui @jianyun8023 @jiazhai PTAL. Thanks. |
| 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()); | ||
| } | ||
| } |
There was a problem hiding this comment.
It is not recommended to use AsyncResponse, just return the value directly.
more info to see #7884
There was a problem hiding this comment.
How about making a new PR to resolve them all?
There was a problem hiding this comment.
I think the new code can comply with this rule.
| Assert.assertEquals(getMaxConsumers, maxConsumers); | ||
|
|
||
| admin.topics().deletePartitionedTopic(persistenceTopic, true); | ||
| admin.topics().deletePartitionedTopic(testTopic, true); |
There was a problem hiding this comment.
remove admin.topics().deletePartitionedTopic(testTopic, true);
There was a problem hiding this comment.
'testTopic' was created in BeforeMethod.
# Conflicts: # pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java
|
/pulsarbot run-failure-checks |
| jcommander.addCommand("get-maxConsumers", new GetMaxConsumers()); | ||
| jcommander.addCommand("set-maxConsumers", new SetMaxConsumers()); | ||
| jcommander.addCommand("remove-maxConsumers", new RemoveMaxConsumers()); |
There was a problem hiding this comment.
| jcommander.addCommand("get-maxConsumers", new GetMaxConsumers()); | |
| jcommander.addCommand("set-maxConsumers", new SetMaxConsumers()); | |
| jcommander.addCommand("remove-maxConsumers", new RemoveMaxConsumers()); | |
| jcommander.addCommand("get-max-consumers", new GetMaxConsumers()); | |
| jcommander.addCommand("set-max-consumers", new SetMaxConsumers()); | |
| jcommander.addCommand("remove-max-consumers", new RemoveMaxConsumers()); |
There was a problem hiding this comment.
And please also update the max producers as the above pattern.
|
/pulsarbot run-failure-checks |
Fix [https://github.com/apache/pulsar/issues/7759](https://github.com/apache/pulsar/issues/7759), and master issue [https://github.com/apache/pulsar/issues/2688](https://github.com/apache/pulsar/issues/2688) ### Motivation Support set/get/remove maxConsumers on a topic level.
Fix #7759, and master issue #2688
Motivation
Support set/get/remove maxConsumers on a topic level.
Verifying this change
new unit test added.