public CompletableFuture<Map<TopicIdPartition, ShareFetchResponseData.PartitionData>> fetchMessages(
        String groupId,
        String memberId,
        FetchParams fetchParams,
        List<TopicIdPartition> topicIdPartitions,
        Map<TopicIdPartition, Integer> partitionMaxBytes
    ) {
        log.trace("Fetch request for topicIdPartitions: {} with groupId: {} fetch params: {}",
            topicIdPartitions, groupId, fetchParams);

        CompletableFuture<Map<TopicIdPartition, ShareFetchResponseData.PartitionData>> future = new CompletableFuture<>();
        ShareFetchPartitionData shareFetchPartitionData = new ShareFetchPartitionData(fetchParams, groupId, memberId,
            topicIdPartitions, future, partitionMaxBytes);
        fetchQueue.add(shareFetchPartitionData);
        maybeProcessFetchQueue();

        return future;
    }
The fetch messages method is used to fetch messages from the log for the specified topic-partitions.
The method returns a future that will be completed with the fetched messages.

@param groupId The group id, this is used to identify the share group.
@param memberId The member id, generated by the group-coordinator, this is used to identify the client.
@param fetchParams The fetch parameters from the share fetch request.
@param topicIdPartitions The topic-partitions to fetch messages for.
@param partitionMaxBytes The maximum number of bytes to fetch for each partition.

@return A future that will be completed with the fetched messages.
core/src/main/java/kafka/server/share/SharePartitionManager.java