AndrewJSchofield commented on code in PR #17626: URL: https://github.com/apache/kafka/pull/17626#discussion_r1827964675
########## clients/src/main/java/org/apache/kafka/clients/admin/ListGroupsOptions.java: ########## @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.kafka.clients.admin; + +import org.apache.kafka.common.GroupType; +import org.apache.kafka.common.annotation.InterfaceStability; + +import java.util.Collections; +import java.util.Set; + +/** + * Options for {@link Admin#listGroups()}. + * <p> + * The API of this class is evolving, see {@link Admin} for details. + */ [email protected] +public class ListGroupsOptions extends AbstractOptions<ListGroupsOptions> { + + private Set<GroupType> types = Collections.emptySet(); + + /** + * If types is set, only groups of these types will be returned by listGroups(). + * Otherwise, all groups are returned. + */ + public ListGroupsOptions withTypes(Set<GroupType> types) { Review Comment: I prefer enums, but I am not 100% convinced with how this works at the moment. We have separate enums for the different group states, but I wonder whether we'd just be better off with a single `GroupState` enum that is the union of all of the existing groups. In practice, `ConsumerGroupState` contains all of the states of the other groups already. This unlocks another possibility which is `ListGroupsOptions.withStates` which I consider worth having. So, I suggest: * Introduce `GroupState` * Introduce `ListGroupsOptions.withStates` * Work out what to do with values beyond the current enum so that an admin client has a chance to cope with new states or group types I'm happy to take this on and do some experimentation if that's OK. -- 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]
