class KafkaOperations implements AutoCloseable {

    public ConsumerGroupOffsets getConsumerGroupOffsets(final String consumerGroupId) {
        try {
            // Create new builder
            final ConsumerGroupOffsets.Builder builder = ConsumerGroupOffsets.newBuilder()
                .withConsumerId(consumerGroupId);

            // Make request
            final ListConsumerGroupOffsetsResult results = adminClient.listConsumerGroupOffsets(consumerGroupId);

            // Iterate over results
            final Map<org.apache.kafka.common.TopicPartition, OffsetAndMetadata> partitionsToOffsets = results
                .partitionsToOffsetAndMetadata()
                .get();

            // Loop over results
            for (final Map.Entry<org.apache.kafka.common.TopicPartition, OffsetAndMetadata> entry : partitionsToOffsets.entrySet()) {
                builder.withOffset(
                    entry.getKey().topic(), entry.getKey().partition(), entry.getValue().offset()
                );
            }

            return builder.build();
        } catch (final ExecutionException e) {
            throw handleExecutionException(e);
        } catch (final InterruptedException  e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }

    public  KafkaOperations(final AdminClient adminClient, final KafkaConsumer<String, String> consumerClient);

}