mimaison commented on a change in pull request #8238:
URL: https://github.com/apache/kafka/pull/8238#discussion_r429131002
##########
File path:
clients/src/main/java/org/apache/kafka/clients/admin/ListConsumerGroupsOptions.java
##########
@@ -26,4 +31,34 @@
*/
@InterfaceStability.Evolving
public class ListConsumerGroupsOptions extends
AbstractOptions<ListConsumerGroupsOptions> {
+
+ private Optional<Set<ConsumerGroupState>> states = Optional.empty();
+
+ /**
+ * Only groups in these states will be returned by listConsumerGroups()
+ * If not set, all groups are returned without their states
+ * throw IllegalArgumentException if states is empty
+ */
+ public ListConsumerGroupsOptions inStates(Set<ConsumerGroupState> states) {
+ if (states == null || states.isEmpty()) {
+ throw new IllegalArgumentException("states should not be null or
empty");
+ }
+ this.states = Optional.of(states);
+ return this;
+ }
+
+ /**
+ * All groups with their states will be returned by listConsumerGroups()
+ */
+ public ListConsumerGroupsOptions inAnyState() {
+ this.states = Optional.of(EnumSet.allOf(ConsumerGroupState.class));
Review comment:
That's a good point so I agree, it makes sense to return all states when
`null` (or an empty list) is used.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]