-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndrewJSchofield thanks for this patch. a couple of comments are left. PTAL
* | ||
* @param options The options to use when listing the consumer groups. | ||
* @return The ListConsumerGroupsResult. | ||
*/ | ||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Deprecated(since = "4.1", forRemoval = true)
* | ||
* @return The ListConsumerGroupsResult. | ||
*/ | ||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Deprecated(since = "4.1", forRemoval = true)
/** | ||
* Returns the list of protocol types that are requested or empty if no protocol types have been specified. | ||
*/ | ||
public Set<String> protocolTypes() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess there will be a follow-up to use this field?
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please change the Collections.emptySet()
to Set.of
for the line#56?
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use {@link Admin#listGroups()} instead.
* 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() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new API is not in KIP-1043, therefore its code style is probably open for discussion 😃
Given that this API appears to be a helper function for creating a specific query, perhaps we could refactor it as a static method.
public static ListGroupsOptions forConsumerGroups() {
return new ListGroupsOptions()
.withTypes(Set.of(GroupType.CLASSIC, GroupType.CONSUMER))
.withProtocolTypes(Set.of("", ConsumerProtocol.PROTOCOL_TYPE));
}
and then the code new ListGroupsOptions().forConsumerGroups()
can be replaced by ListGroupsOptions.forConsumerGroups()
The final part of KIP-1043 is to deprecate Admin.listConsumerGroups() in
favour of Admin.listGroups() which works for all group types.