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."); } }
value.members().forEach((member) -> { value.coordinator().id(), value.coordinator().host(), value.coordinator().port(), value.coordinator().rack() ); value.groupId(), value.isSimpleConsumerGroup(), value.partitionAssignor(), value.state().toString(), members, coordinator
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 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(); }
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."); } }