Technoboy- commented on code in PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#discussion_r887420405


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java:
##########
@@ -864,11 +872,19 @@ public void 
setSubscriptionDispatchRate(@PathParam("property") String property,
             + "in dispatch-rate yet")
     @ApiResponses(value = {@ApiResponse(code = 403, message = "Don't have 
admin permission"),
             @ApiResponse(code = 404, message = "Namespace does not exist")})
-    public DispatchRate getSubscriptionDispatchRate(@PathParam("property") 
String property,
-                                                    @PathParam("cluster") 
String cluster,
-                                                    @PathParam("namespace") 
String namespace) {
+    public void getSubscriptionDispatchRate(@Suspended AsyncResponse 
asyncResponse,
+                                            @PathParam("property") String 
property,
+                                            @PathParam("cluster") String 
cluster,
+                                            @PathParam("namespace") String 
namespace) {
         validateNamespaceName(property, cluster, namespace);
-        return internalGetSubscriptionDispatchRate();
+        internalGetSubscriptionDispatchRateAsync()
+                .thenAccept(asyncResponse::resume)
+                .exceptionally(ex -> {
+                    log.error("Failed to get the subscription dispatchRate for 
cluster on namespace {}"
+                            , namespaceName, ex);
+                    resumeAsyncResponseExceptionally(asyncResponse, ex);

Review Comment:
   and here.



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java:
##########
@@ -877,11 +893,19 @@ public DispatchRate 
getSubscriptionDispatchRate(@PathParam("property") String pr
     @ApiResponses(value = {@ApiResponse(code = 403, message = "Don't have 
admin permission"),
             @ApiResponse(code = 404, message = "Property or cluster or 
namespace doesn't exist"),
             @ApiResponse(code = 409, message = "Concurrent modification")})
-    public void deleteSubscriptionDispatchRate(@PathParam("property") String 
property,
+    public void deleteSubscriptionDispatchRate(@Suspended AsyncResponse 
asyncResponse,
+                                               @PathParam("property") String 
property,
                                                @PathParam("cluster") String 
cluster,
                                                @PathParam("namespace") String 
namespace) {
         validateNamespaceName(property, cluster, namespace);
-        internalDeleteSubscriptionDispatchRate();
+        internalDeleteSubscriptionDispatchRateAsync()
+                .thenAccept(__ -> 
asyncResponse.resume(Response.noContent().build()))
+                .exceptionally(ex -> {
+                    log.error("Failed to delete the subscription dispatchRate 
for cluster on namespace {}"
+                            , namespaceName, ex);

Review Comment:
   and here



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

Reply via email to