Skip to content
Closed
Show file tree
Hide file tree
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 Nov 4, 2017
5cfab0b
document changes
jeqo Nov 5, 2017
5a4b5a5
add `listConsumerGroups`
jeqo Nov 6, 2017
6468069
consumer group and instance class documentation
jeqo Nov 14, 2017
f888167
renaming to support groups (including connect groups)
jeqo Jan 7, 2018
4eac264
merge
jeqo Jan 19, 2018
6483c59
add list groups/consumer groups and list group offsets
jeqo Jan 20, 2018
d0f8596
increase class fan out, add test method unsupported exceptions
jeqo Jan 20, 2018
61e4780
refactor listGroupOffsets
jeqo Jan 20, 2018
9cd4c51
add support for offsetandmetadata as part of listGroupOffsets
jeqo Jan 21, 2018
9fd47ee
refactor member description assignment to support extensibility
jeqo Jan 22, 2018
6db76dd
refactor member description assignment to support extensibility
jeqo Jan 22, 2018
624fffa
fix checkstyle
jeqo Jan 22, 2018
3d51d69
improve documentation
jeqo Jan 23, 2018
f0bcca5
fix bug: self assignment variable. typo
jeqo Jan 24, 2018
ee9c074
change scope of groups to consumergroups
jeqo Jan 30, 2018
1baa9e5
fix removed method
jeqo Jan 30, 2018
6558697
rename protocol to partitionassignor
jeqo Feb 5, 2018
9d135cd
lookup for coordinator before describe consumer group
jeqo Feb 5, 2018
82d3fab
Merge remote-tracking branch 'origin/trunk' into feature/admin-client…
jeqo Feb 6, 2018
98782cb
lookup for coordinator before list consumer group and offset
jeqo Feb 9, 2018
e24589d
Merge remote-tracking branch 'origin/trunk' into feature/admin-client…
jeqo Mar 11, 2018
bcf89d5
unit testing list consumer groups
jeqo Mar 18, 2018
44f67d4
missing unit tests
jeqo Mar 18, 2018
fd3442c
Merge branch 'feature/admin-client-describe-consumer-group' of github…
jeqo Mar 20, 2018
4d2af0c
Merge remote-tracking branch 'origin/trunk' into feature/admin-client…
jeqo Mar 22, 2018
60f46fa
unit testing kip-222
jeqo Mar 22, 2018
fa2a5eb
support delete consumer groups
jeqo Mar 23, 2018
3e1e137
fix test
jeqo Mar 23, 2018
34a288f
fix toString ConsuerGroupListing
jeqo Mar 23, 2018
48a59af
ask any node for coordinator node
jeqo Mar 26, 2018
38391f3
fix memberDescription properties
jeqo Mar 26, 2018
12bfe2a
fix to delete each group independently
jeqo Mar 27, 2018
bfa3066
remove inner Kafka Futures
jeqo Apr 4, 2018
7fa3f57
handle partition data errors
jeqo Apr 4, 2018
7a9eb2e
revert remove inner Kafka Futures
jeqo Apr 4, 2018
4a723c0
Merge branch 'feature/admin-client-describe-consumer-group' of https:…
guozhangwang Apr 5, 2018
b8f8fd1
block and flatten after the first iteration
guozhangwang Apr 5, 2018
d5db4e9
MINOR: fix streams test-utils dependencies (#4821)
vvcephei Apr 5, 2018
5f0add5
Merge remote-tracking branch 'origin/trunk' into feature/admin-client…
jeqo Apr 5, 2018
5bbd120
Merge branch 'KMinor-improve-kafka-future' of https://github.com/guoz…
jeqo Apr 5, 2018
9118024
Merge branch 'guozhangwang-KMinor-improve-kafka-future' into feature/…
jeqo Apr 5, 2018
53d4267
MINOR: Don’t send the DeleteTopicsRequest for invalid topic names (#4…
chia7712 Apr 5, 2018
9f8c316
KAFKA-4292: Configurable SASL callback handlers (KIP-86) (#2022)
rajinisivaram Apr 5, 2018
63642d6
KAFKA-6694: The Trogdor Coordinator should support filtering task res…
cmccabe Apr 5, 2018
77c79df
KAFKA-6741: Disable Selector's idle connection timeout in testNetwor…
omkreddy Apr 5, 2018
ed2f10e
MINOR: Update max.connections.per.ip.overrides config docs (#4819)
omkreddy Apr 5, 2018
3abd410
KAFKA-6748: double check before scheduling a new task after the punct…
Apr 5, 2018
ac542c9
KAFKA-6747 Check whether there is in-flight transaction before aborti…
tedyu Apr 5, 2018
da32db9
Trogdor: Added commonClientConf and adminClientConf to workload specs…
apovzner Apr 6, 2018
77ebd32
KAFKA-6576: Configurable Quota Management (KIP-257) (#4699)
rajinisivaram Apr 6, 2018
0c0d836
KAFKA-6054: Fix upgrade path from Kafka Streams v0.10.0 (#4779)
mjsax Apr 7, 2018
fedac0c
MINOR: Mention leader in a few follower/controller log messages (#4835)
ijuma Apr 8, 2018
40183e3
KAFKA-6688. The Trogdor coordinator should track task statuses (#4737)
cmccabe Apr 8, 2018
37efc79
MINOR: Remove magic number and extract Pattern instance from method a…
asdf2014 Apr 8, 2018
e6b4d17
MINOR: Java 10 fixes so that the build passes (#4839)
ijuma Apr 9, 2018
0a8f35b
KAFKA-6768; Transactional producer may hang in close with pending req…
hachikuji Apr 9, 2018
989fe04
Kafka-6693: Added consumer workload to Trogdor (#4775)
apovzner Apr 10, 2018
e490a90
Make [Config]Resource.toString() consistent with existing code (#4845)
edenhill Apr 10, 2018
79c6f7c
MINOR: Move creation of quota callback to ensure single instance (#4848)
rajinisivaram Apr 10, 2018
5e277e5
KAFKA-4883: handle NullPointerException while parsing login modue con…
omkreddy Apr 10, 2018
4223ef6
MINOR: Add NullPayloadGenerator to Trogdor (#4844)
cmccabe Apr 10, 2018
cb36215
fix test with updated method firm
jeqo Apr 10, 2018
9fb5f82
remove redundant access methods
jeqo Apr 11, 2018
f410834
remove redundant access methods
jeqo Apr 11, 2018
055c557
remove unused imports
jeqo Apr 11, 2018
175ff6d
ignoring test to be fixed on follow-up PR
jeqo Apr 11, 2018
e29fa9a
KAFKA-6752: Enable unclean leader election metric (#4838)
omkreddy Apr 11, 2018
47918f2
KAFKA-6447: Add Delegation Token Operations to KafkaAdminClient (KIP-…
omkreddy Apr 11, 2018
1d832b3
rebase from trunk
guozhangwang Apr 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

<module name="ClassFanOutComplexity">
<!-- default is 20 -->
<property name="max" value="40"/>
<property name="max" value="50"/>
</module>
<module name="CyclomaticComplexity">
<!-- default is 10-->
Expand Down
2 changes: 2 additions & 0 deletions checkstyle/import-control.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@

<subpackage name="admin">
<allow pkg="org.apache.kafka.clients.admin" />
<allow pkg="org.apache.kafka.clients.consumer.internals" />
<allow pkg="org.apache.kafka.clients.consumer" />
</subpackage>
</subpackage>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,4 +535,66 @@ public DeleteRecordsResult deleteRecords(Map<TopicPartition, RecordsToDelete> re
*/
public abstract DeleteRecordsResult deleteRecords(Map<TopicPartition, RecordsToDelete> recordsToDelete,
DeleteRecordsOptions options);
/**
* Describe some group IDs in the cluster.
*
* @param groupIds The IDs of the groups to describe.
* @param options The options to use when describing the groups.
* @return The DescribeConsumerGroupResult.
*/
public abstract DescribeConsumerGroupsResult describeConsumerGroups(Collection<String> groupIds,
DescribeConsumerGroupsOptions options);

/**
* Describe some group IDs in the cluster, with the default options.
* <p>
* This is a convenience method for
* #{@link AdminClient#describeConsumerGroups(Collection, DescribeConsumerGroupsOptions)} with
* default options. See the overload for more details.
*
* @param groupIds The IDs of the groups to describe.
* @return The DescribeConsumerGroupResult.
*/
public DescribeConsumerGroupsResult describeConsumerGroups(Collection<String> groupIds) {
return describeConsumerGroups(groupIds, new DescribeConsumerGroupsOptions());
}

/**
* List the consumer groups available in the cluster.
*
* @param options The options to use when listing the groups.
* @return The ListGroupsResult.
*/
public abstract ListConsumerGroupsResult listConsumerGroups(ListConsumerGroupsOptions options);

/**
* List the consumer groups available in the cluster with the default options.
*
* This is a convenience method for #{@link AdminClient#listConsumerGroups(ListConsumerGroupsOptions)} with default options.
* See the overload for more details.
*
* @return The ListGroupsResult.
*/
public ListConsumerGroupsResult listConsumerGroups() {
return listConsumerGroups(new ListConsumerGroupsOptions());
}

/**
* List the group offsets available in the cluster.
*
* @param options The options to use when listing the group offsets.
* @return The ListGroupOffsetsResult
*/
public abstract ListConsumerGroupOffsetsResult listConsumerGroupOffsets(String groupId, ListConsumerGroupOffsetsOptions options);

/**
* List the group offsets available in the cluster with the default options.
*
* This is a convenience method for #{@link AdminClient#listConsumerGroupOffsets(String, ListConsumerGroupOffsetsOptions)} with default options.
*
* @return The ListGroupOffsetsResult.
*/
public ListConsumerGroupOffsetsResult listConsumerGroupOffsets(String groupId) {
return listConsumerGroupOffsets(groupId, new ListConsumerGroupOffsetsOptions());
}
}
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;

Copy link
Copy Markdown
Contributor

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"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


/**
* 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 + ")";
}
}
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 + ")";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not including groupId here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I'll fix it.

}
}
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> {
}
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;
}
});
}

}
Loading