Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleListConsumerGroupsOptions
public class ListConsumerGroupsOptions extends AbstractOptions<ListConsumerGroupsOptions> {

    /**
     * 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) { }
 
    /**
     * All groups with their states will be returned by listConsumerGroups()
     */
    public ListConsumerGroupsOptions inAnyState() { }
 
    /**
     * Returns the list of States that are requested or null if no states have been specified
     */
    public Set<ConsumerGroupState>Optional<Set<ConsumerGroupState>> states() { }
}

Similarly, a state field will be exposed in ConsumerGroupListing:

...

No Format
# Existing behaviour
./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
group1
group2

# Listing all groups with their states
./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list --state
GROUP          STATE
group1         stable
group2         empty

# Listing groups in the stable state
./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list --statesstate stable
GROUP          STATE
group1         stable

...