-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KIP-222 - Add Consumer Group operations to Admin API #4454
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
Closed
jeqo
wants to merge
70
commits into
apache:trunk
from
jeqo:feature/admin-client-describe-consumer-group
Closed
Changes from 17 commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
3c327ed
draft describeConsumerGroups on KafkaAdminClient
jeqo 5cfab0b
document changes
jeqo 5a4b5a5
add `listConsumerGroups`
jeqo 6468069
consumer group and instance class documentation
jeqo f888167
renaming to support groups (including connect groups)
jeqo 4eac264
merge
jeqo 6483c59
add list groups/consumer groups and list group offsets
jeqo d0f8596
increase class fan out, add test method unsupported exceptions
jeqo 61e4780
refactor listGroupOffsets
jeqo 9cd4c51
add support for offsetandmetadata as part of listGroupOffsets
jeqo 9fd47ee
refactor member description assignment to support extensibility
jeqo 6db76dd
refactor member description assignment to support extensibility
jeqo 624fffa
fix checkstyle
jeqo 3d51d69
improve documentation
jeqo f0bcca5
fix bug: self assignment variable. typo
jeqo ee9c074
change scope of groups to consumergroups
jeqo 1baa9e5
fix removed method
jeqo 6558697
rename protocol to partitionassignor
jeqo 9d135cd
lookup for coordinator before describe consumer group
jeqo 82d3fab
Merge remote-tracking branch 'origin/trunk' into feature/admin-client…
jeqo 98782cb
lookup for coordinator before list consumer group and offset
jeqo e24589d
Merge remote-tracking branch 'origin/trunk' into feature/admin-client…
jeqo bcf89d5
unit testing list consumer groups
jeqo 44f67d4
missing unit tests
jeqo fd3442c
Merge branch 'feature/admin-client-describe-consumer-group' of github…
jeqo 4d2af0c
Merge remote-tracking branch 'origin/trunk' into feature/admin-client…
jeqo 60f46fa
unit testing kip-222
jeqo fa2a5eb
support delete consumer groups
jeqo 3e1e137
fix test
jeqo 34a288f
fix toString ConsuerGroupListing
jeqo 48a59af
ask any node for coordinator node
jeqo 38391f3
fix memberDescription properties
jeqo 12bfe2a
fix to delete each group independently
jeqo bfa3066
remove inner Kafka Futures
jeqo 7fa3f57
handle partition data errors
jeqo 7a9eb2e
revert remove inner Kafka Futures
jeqo 4a723c0
Merge branch 'feature/admin-client-describe-consumer-group' of https:…
guozhangwang b8f8fd1
block and flatten after the first iteration
guozhangwang d5db4e9
MINOR: fix streams test-utils dependencies (#4821)
vvcephei 5f0add5
Merge remote-tracking branch 'origin/trunk' into feature/admin-client…
jeqo 5bbd120
Merge branch 'KMinor-improve-kafka-future' of https://github.com/guoz…
jeqo 9118024
Merge branch 'guozhangwang-KMinor-improve-kafka-future' into feature/…
jeqo 53d4267
MINOR: Don’t send the DeleteTopicsRequest for invalid topic names (#4…
chia7712 9f8c316
KAFKA-4292: Configurable SASL callback handlers (KIP-86) (#2022)
rajinisivaram 63642d6
KAFKA-6694: The Trogdor Coordinator should support filtering task res…
cmccabe 77c79df
KAFKA-6741: Disable Selector's idle connection timeout in testNetwor…
omkreddy ed2f10e
MINOR: Update max.connections.per.ip.overrides config docs (#4819)
omkreddy 3abd410
KAFKA-6748: double check before scheduling a new task after the punct…
ac542c9
KAFKA-6747 Check whether there is in-flight transaction before aborti…
tedyu da32db9
Trogdor: Added commonClientConf and adminClientConf to workload specs…
apovzner 77ebd32
KAFKA-6576: Configurable Quota Management (KIP-257) (#4699)
rajinisivaram 0c0d836
KAFKA-6054: Fix upgrade path from Kafka Streams v0.10.0 (#4779)
mjsax fedac0c
MINOR: Mention leader in a few follower/controller log messages (#4835)
ijuma 40183e3
KAFKA-6688. The Trogdor coordinator should track task statuses (#4737)
cmccabe 37efc79
MINOR: Remove magic number and extract Pattern instance from method a…
asdf2014 e6b4d17
MINOR: Java 10 fixes so that the build passes (#4839)
ijuma 0a8f35b
KAFKA-6768; Transactional producer may hang in close with pending req…
hachikuji 989fe04
Kafka-6693: Added consumer workload to Trogdor (#4775)
apovzner e490a90
Make [Config]Resource.toString() consistent with existing code (#4845)
edenhill 79c6f7c
MINOR: Move creation of quota callback to ensure single instance (#4848)
rajinisivaram 5e277e5
KAFKA-4883: handle NullPointerException while parsing login modue con…
omkreddy 4223ef6
MINOR: Add NullPayloadGenerator to Trogdor (#4844)
cmccabe cb36215
fix test with updated method firm
jeqo 9fb5f82
remove redundant access methods
jeqo f410834
remove redundant access methods
jeqo 055c557
remove unused imports
jeqo 175ff6d
ignoring test to be fixed on follow-up PR
jeqo e29fa9a
KAFKA-6752: Enable unclean leader election metric (#4838)
omkreddy 47918f2
KAFKA-6447: Add Delegation Token Operations to KafkaAdminClient (KIP-…
omkreddy 1d832b3
rebase from trunk
guozhangwang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
clients/src/main/java/org/apache/kafka/clients/admin/ConsumerGroupDescription.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| /* | ||
| * 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.utils.Utils; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| /** | ||
| * A detailed description of a single consumer group in the cluster. | ||
| */ | ||
| public class ConsumerGroupDescription { | ||
|
|
||
| private final String groupId; | ||
| private final boolean isSimpleConsumerGroup; | ||
| private final List<MemberDescription> members; | ||
| private final String protocol; | ||
|
|
||
| /** | ||
| * Creates an instance with the specified parameters. | ||
| * | ||
| * @param groupId The consumer group id | ||
| * @param isSimpleConsumerGroup if Consumer Group is simple | ||
| * @param members The consumer group members | ||
| * @param protocol The consumer group protocol | ||
| */ | ||
| public ConsumerGroupDescription(String groupId, boolean isSimpleConsumerGroup, List<MemberDescription> members, String protocol) { | ||
| this.groupId = groupId; | ||
| this.isSimpleConsumerGroup = isSimpleConsumerGroup; | ||
| this.members = members; | ||
| this.protocol = protocol; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) return true; | ||
| if (o == null || getClass() != o.getClass()) return false; | ||
|
|
||
| ConsumerGroupDescription that = (ConsumerGroupDescription) o; | ||
|
|
||
| if (isSimpleConsumerGroup != that.isSimpleConsumerGroup) return false; | ||
| if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) return false; | ||
| if (members != null ? !members.equals(that.members) : that.members != null) return false; | ||
| return protocol != null ? protocol.equals(that.protocol) : that.protocol == null; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| int result = groupId != null ? groupId.hashCode() : 0; | ||
| result = 31 * result + (isSimpleConsumerGroup ? 1 : 0); | ||
| result = 31 * result + (members != null ? members.hashCode() : 0); | ||
| result = 31 * result + (protocol != null ? protocol.hashCode() : 0); | ||
| return result; | ||
| } | ||
|
|
||
| /** | ||
| * The id of the consumer group. | ||
| */ | ||
| public String groupId() { | ||
| return groupId; | ||
| } | ||
|
|
||
| /** | ||
| * If consumer group is simple or not. | ||
| */ | ||
| public boolean isSimpleConsumerGroup() { | ||
| return isSimpleConsumerGroup; | ||
| } | ||
|
|
||
| /** | ||
| * A list of the members of the consumer group. | ||
| */ | ||
| public List<MemberDescription> members() { | ||
| return members; | ||
| } | ||
|
|
||
| /** | ||
| * The consumer group protocol. | ||
| */ | ||
| public String protocol() { | ||
| return protocol; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "(groupId=" + groupId + ", isSimpleConsumerGroup=" + isSimpleConsumerGroup + ", members=" + | ||
| Utils.join(members, ",") + ", protocol=" + protocol + ")"; | ||
| } | ||
| } | ||
46 changes: 46 additions & 0 deletions
46
clients/src/main/java/org/apache/kafka/clients/admin/ConsumerGroupListing.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * 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; | ||
|
|
||
| /** | ||
| * A listing of a consumer group in the cluster. | ||
| */ | ||
| public class ConsumerGroupListing { | ||
| private final boolean isSimpleConsumerGroup; | ||
|
|
||
| /** | ||
| * Create an instance with the specified parameters. | ||
| * | ||
| * @param isSimpleConsumerGroup If consumer group is simple or not. | ||
| */ | ||
| public ConsumerGroupListing(boolean isSimpleConsumerGroup) { | ||
| this.isSimpleConsumerGroup = isSimpleConsumerGroup; | ||
| } | ||
|
|
||
| /** | ||
| * If Consumer Group is simple or not. | ||
| */ | ||
| public boolean isSimpleConsumerGroup() { | ||
| return isSimpleConsumerGroup; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "(isSimpleConsumerGroup=" + isSimpleConsumerGroup + ")"; | ||
|
Contributor
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. Why not including groupId here?
Contributor
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. You're right. I'll fix it. |
||
| } | ||
| } | ||
31 changes: 31 additions & 0 deletions
31
clients/src/main/java/org/apache/kafka/clients/admin/DescribeConsumerGroupsOptions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * 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.annotation.InterfaceStability; | ||
|
|
||
| import java.util.Collection; | ||
|
|
||
| /** | ||
| * Options for {@link AdminClient#describeConsumerGroups(Collection, DescribeConsumerGroupsOptions)}. | ||
| * <p> | ||
| * The API of this class is evolving, see {@link AdminClient} for details. | ||
| */ | ||
| @InterfaceStability.Evolving | ||
| public class DescribeConsumerGroupsOptions extends AbstractOptions<DescribeConsumerGroupsOptions> { | ||
| } |
73 changes: 73 additions & 0 deletions
73
clients/src/main/java/org/apache/kafka/clients/admin/DescribeConsumerGroupsResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /* | ||
| * 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.KafkaFuture; | ||
| import org.apache.kafka.common.annotation.InterfaceStability; | ||
|
|
||
| import java.util.Collection; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| import java.util.concurrent.ExecutionException; | ||
|
|
||
|
|
||
| /** | ||
| * The result of the {@link KafkaAdminClient#describeConsumerGroups(Collection, DescribeConsumerGroupsOptions)}} call. | ||
| * | ||
| * The API of this class is evolving, see {@link AdminClient} for details. | ||
| */ | ||
| @InterfaceStability.Evolving | ||
| public class DescribeConsumerGroupsResult { | ||
|
|
||
| private final Map<String, KafkaFuture<ConsumerGroupDescription>> futures; | ||
|
|
||
| public DescribeConsumerGroupsResult(Map<String, KafkaFuture<ConsumerGroupDescription>> futures) { | ||
| this.futures = futures; | ||
| } | ||
|
|
||
| /** | ||
| * Return a map from group name to futures which can be used to check the description of a consumer group. | ||
| */ | ||
| public Map<String, KafkaFuture<ConsumerGroupDescription>> values() { | ||
| return futures; | ||
| } | ||
|
|
||
| /** | ||
| * Return a future which succeeds only if all the consumer group descriptions succeed. | ||
| */ | ||
| public KafkaFuture<Map<String, ConsumerGroupDescription>> all() { | ||
| return KafkaFuture.allOf(futures.values().toArray(new KafkaFuture[0])). | ||
| thenApply(new KafkaFuture.Function<Void, Map<String, ConsumerGroupDescription>>() { | ||
| @Override | ||
| public Map<String, ConsumerGroupDescription> apply(Void v) { | ||
| Map<String, ConsumerGroupDescription> descriptions = new HashMap<>(futures.size()); | ||
| for (Map.Entry<String, KafkaFuture<ConsumerGroupDescription>> entry : futures.entrySet()) { | ||
| try { | ||
| descriptions.put(entry.getKey(), entry.getValue().get()); | ||
| } catch (InterruptedException | ExecutionException e) { | ||
| // This should be unreachable, because allOf ensured that all the futures | ||
| // completed successfully. | ||
| throw new RuntimeException(e); | ||
| } | ||
| } | ||
| return descriptions; | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Maybe we can use the consumer-specific term "partitionAssignor"?
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.
👍