This is an automated email from the ASF dual-hosted git repository. rdhabalia pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push: new faebd13 [pulsar-broker-admin] Support replication dispatch-rate limiting for v1-namespace api (#8314) faebd13 is described below commit faebd13639a8e41e36d48bcd0756de2c6ab40411 Author: Rajan Dhabalia <rdhaba...@apache.org> AuthorDate: Wed Oct 21 10:32:03 2020 -0700 [pulsar-broker-admin] Support replication dispatch-rate limiting for v1-namespace api (#8314) --- .../apache/pulsar/broker/admin/v1/Namespaces.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java index 3fc076b..035c6f8 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java @@ -21,6 +21,7 @@ package org.apache.pulsar.broker.admin.v1; import com.google.common.collect.Lists; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import org.apache.pulsar.broker.admin.impl.NamespacesBase; @@ -637,6 +638,29 @@ public class Namespaces extends NamespacesBase { return internalGetSubscriptionDispatchRate(); } + @POST + @Path("/{tenant}/{cluster}/{namespace}/replicatorDispatchRate") + @ApiOperation(value = "Set replicator dispatch-rate throttling for all topics of the namespace") + @ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission") }) + public void setReplicatorDispatchRate(@PathParam("tenant") String tenant, + @PathParam("cluster") String cluster, @PathParam("namespace") String namespace, + @ApiParam(value = "Replicator dispatch rate for all topics of the specified namespace") DispatchRate dispatchRate) { + validateNamespaceName(tenant, cluster, namespace); + internalSetReplicatorDispatchRate(dispatchRate); + } + + @GET + @Path("/{tenant}/{cluster}/{namespace}/replicatorDispatchRate") + @ApiOperation(value = "Get replicator dispatch-rate configured for the namespace, -1 represents not configured yet") + @ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission"), + @ApiResponse(code = 404, message = "Namespace does not exist") }) + public DispatchRate getReplicatorDispatchRate(@PathParam("tenant") String tenant, + @PathParam("cluster") String cluster, + @PathParam("namespace") String namespace) { + validateNamespaceName(tenant, cluster, namespace); + return internalGetReplicatorDispatchRate(); + } + @GET @Path("/{property}/{cluster}/{namespace}/backlogQuotaMap") @ApiOperation(hidden = true, value = "Get backlog quota map on a namespace.")