-
Notifications
You must be signed in to change notification settings - Fork 14.9k
KAFKA-17897: Deprecate Admin.listConsumerGroups #19477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
c0424b6
4bcdd34
bf4f385
c2836cc
59be8fa
b57465d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -879,20 +879,24 @@ default DescribeConsumerGroupsResult describeConsumerGroups(Collection<String> g | |
|
|
||
| /** | ||
| * List the consumer groups available in the cluster. | ||
| * @deprecated Since 4.1. Use {@link Admin#listGroups(ListGroupsOptions)} instead. | ||
| * | ||
| * @param options The options to use when listing the consumer groups. | ||
| * @return The ListConsumerGroupsResult. | ||
| */ | ||
| @Deprecated | ||
| ListConsumerGroupsResult listConsumerGroups(ListConsumerGroupsOptions options); | ||
|
|
||
| /** | ||
| * List the consumer groups available in the cluster with the default options. | ||
| * <p> | ||
| * This is a convenience method for {@link #listConsumerGroups(ListConsumerGroupsOptions)} with default options. | ||
| * See the overload for more details. | ||
| * @deprecated Since 4.1. Use {@link Admin#listGroups(ListGroupsOptions)} instead. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. If you want |
||
| * | ||
| * @return The ListConsumerGroupsResult. | ||
| */ | ||
| @Deprecated | ||
AndrewJSchofield marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| default ListConsumerGroupsResult listConsumerGroups() { | ||
| return listConsumerGroups(new ListConsumerGroupsOptions()); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
|
|
||
| package org.apache.kafka.clients.admin; | ||
|
|
||
| import org.apache.kafka.clients.consumer.internals.ConsumerProtocol; | ||
| import org.apache.kafka.common.GroupState; | ||
| import org.apache.kafka.common.GroupType; | ||
| import org.apache.kafka.common.annotation.InterfaceStability; | ||
|
|
@@ -32,8 +33,19 @@ | |
| @InterfaceStability.Evolving | ||
| public class ListGroupsOptions extends AbstractOptions<ListGroupsOptions> { | ||
|
|
||
| private Set<GroupState> groupStates = Collections.emptySet(); | ||
| private Set<GroupType> types = Collections.emptySet(); | ||
| private Set<GroupState> groupStates = Set.of(); | ||
| private Set<GroupType> types = Set.of(); | ||
| private Set<String> protocolTypes = Set.of(); | ||
|
|
||
| /** | ||
| * Only consumer groups will be returned by listGroups(). | ||
| * This operation sets filters on group type and protocol type which select consumer groups. | ||
| */ | ||
| public ListGroupsOptions forConsumerGroups() { | ||
|
||
| this.types = Set.of(GroupType.CLASSIC, GroupType.CONSUMER); | ||
| this.protocolTypes = Set.of("", ConsumerProtocol.PROTOCOL_TYPE); | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * If groupStates is set, only groups in these states will be returned by listGroups(). | ||
|
|
@@ -45,6 +57,11 @@ public ListGroupsOptions inGroupStates(Set<GroupState> groupStates) { | |
| return this; | ||
| } | ||
|
|
||
| public ListGroupsOptions withProtocolTypes(Set<String> protocolTypes) { | ||
| this.protocolTypes = (protocolTypes == null || protocolTypes.isEmpty()) ? Set.of() : Set.copyOf(protocolTypes); | ||
AndrewJSchofield marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * If types is set, only groups of these types will be returned by listGroups(). | ||
| * Otherwise, all groups are returned. | ||
|
|
@@ -61,6 +78,13 @@ public Set<GroupState> groupStates() { | |
| return groupStates; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the list of protocol types that are requested or empty if no protocol types have been specified. | ||
| */ | ||
| public Set<String> protocolTypes() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess there will be a follow-up to use this field?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I'll add a few more tests. And update the KIP of course. |
||
| return protocolTypes; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the list of group types that are requested or empty if no types have been specified. | ||
| */ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.