Skip to content

Commit

Permalink
[pulsar-broker-admin] Support replication dispatch-rate limiting for …
Browse files Browse the repository at this point in the history
…v1-namespace api (apache#8314)
  • Loading branch information
rdhabalia authored Oct 21, 2020
1 parent 656bcb2 commit faebd13
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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;
Expand Down Expand Up @@ -637,6 +638,29 @@ public DispatchRate getSubscriptionDispatchRate(@PathParam("property") String pr
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.")
Expand Down

0 comments on commit faebd13

Please sign in to comment.