final ConsumerGroupDescription groupDescription = result.describedGroups().get("group-0").get(); assertEquals(1, result.describedGroups().size()); assertEquals("group-0", groupDescription.groupId()); assertEquals(2, groupDescription.members().size());
return new DescribeConsumerGroupsResult(new HashMap<>(futures));
private int numberOfAssignmentsForConsumersGroups(List<String> consumerGroupsIds) throws ExecutionException, InterruptedException { Collection<ConsumerGroupDescription> consumerGroupsDescriptions = adminClient.describeConsumerGroups(consumerGroupsIds).all().get().values(); Stream<MemberDescription> memberDescriptions = consumerGroupsDescriptions.stream().flatMap(desc -> desc.members().stream()); return memberDescriptions.flatMap(memberDescription -> memberDescription.assignment().topicPartitions().stream()).collect(Collectors.toList()).size(); }
.all() .get() .forEach((key, value) -> {
private void validateNoActiveConsumers(final String groupId, final AdminClient adminClient) throws ExecutionException, InterruptedException { final DescribeConsumerGroupsResult describeResult = adminClient.describeConsumerGroups(Arrays.asList(groupId), (new DescribeConsumerGroupsOptions()).timeoutMs(10 * 1000)); final List<MemberDescription> members = new ArrayList<MemberDescription>(describeResult.describedGroups().get(groupId).get().members()); if (!members.isEmpty()) { throw new IllegalStateException("Consumer group '" + groupId + "' is still active " + "and has following members: " + members + ". " + "Make sure to stop all running application instances before running the reset tool."); } }
private void validateNoActiveConsumers(final String groupId, final AdminClient adminClient) throws ExecutionException, InterruptedException { final DescribeConsumerGroupsResult describeResult = adminClient.describeConsumerGroups(Arrays.asList(groupId), (new DescribeConsumerGroupsOptions()).timeoutMs(10 * 1000)); final List<MemberDescription> members = new ArrayList<MemberDescription>(describeResult.describedGroups().get(groupId).get().members()); if (!members.isEmpty()) { throw new IllegalStateException("Consumer group '" + groupId + "' is still active " + "and has following members: " + members + ". " + "Make sure to stop all running application instances before running the reset tool."); } }
private void validateNoActiveConsumers(final String groupId, final AdminClient adminClient) throws ExecutionException, InterruptedException { final DescribeConsumerGroupsResult describeResult = adminClient.describeConsumerGroups(Arrays.asList(groupId), (new DescribeConsumerGroupsOptions()).timeoutMs(10 * 1000)); final List<MemberDescription> members = new ArrayList<MemberDescription>(describeResult.describedGroups().get(groupId).get().members()); if (!members.isEmpty()) { throw new IllegalStateException("Consumer group '" + groupId + "' is still active " + "and has following members: " + members + ". " + "Make sure to stop all running application instances before running the reset tool."); } }
private void validateNoActiveConsumers(final String groupId, final AdminClient adminClient) throws ExecutionException, InterruptedException { final DescribeConsumerGroupsResult describeResult = adminClient.describeConsumerGroups(Arrays.asList(groupId), (new DescribeConsumerGroupsOptions()).timeoutMs(10 * 1000)); final List<MemberDescription> members = new ArrayList<MemberDescription>(describeResult.describedGroups().get(groupId).get().members()); if (!members.isEmpty()) { throw new IllegalStateException("Consumer group '" + groupId + "' is still active " + "and has following members: " + members + ". " + "Make sure to stop all running application instances before running the reset tool."); } }