AndrewJSchofield commented on code in PR #19743:
URL: https://github.com/apache/kafka/pull/19743#discussion_r2095334181


##########
clients/src/main/java/org/apache/kafka/common/requests/ListConfigResourcesRequest.java:
##########
@@ -28,14 +28,25 @@
 public class ListConfigResourcesRequest extends AbstractRequest {
     public static class Builder extends 
AbstractRequest.Builder<ListConfigResourcesRequest> {
         public final ListConfigResourcesRequestData data;
+        private final boolean fallbackToV0;
 
         public Builder(ListConfigResourcesRequestData data) {
             super(ApiKeys.LIST_CONFIG_RESOURCES);
             this.data = data;
+            this.fallbackToV0 = false;
+        }
+
+        public Builder(ListConfigResourcesRequestData data, boolean 
fallbackToV0) {
+            super(ApiKeys.LIST_CONFIG_RESOURCES);
+            this.data = data;
+            this.fallbackToV0 = fallbackToV0;
         }
 
         @Override
         public ListConfigResourcesRequest build(short version) {
+            if (fallbackToV0) {

Review Comment:
   I suggest managing the fallback case slightly differently.
   
   If the broker only supports v0, the build request will supply 0 as the 
parameter. Then you can reject the build request with 
`UnsupportedVersionException` if the config resource types are not just 
`CLIENT_METRICS`. I suggest looking at `ListGroupsRequest`.



##########
clients/src/main/java/org/apache/kafka/common/requests/ListConfigResourcesResponse.java:
##########
@@ -79,6 +79,7 @@ public Collection<ConfigResource> configResources() {
             ).collect(Collectors.toList());
     }
 
+    @SuppressWarnings("deprecation")

Review Comment:
   This seems wrong. Since the only use of this method is in 
`KafkaAdminClient.listClientMetricsResources`, which itself a deprecated 
method, I would just remove this method and put the code to create the 
`ClientMetricsResourceListing` instances directly in `KafkaAdminClient`.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to