Class SharePartitionManager

java.lang.Object
kafka.server.share.SharePartitionManager
All Implemented Interfaces:
AutoCloseable

public class SharePartitionManager extends Object implements AutoCloseable
The SharePartitionManager is responsible for managing the SharePartitions and ShareSessions. It is responsible for fetching messages from the log and acknowledging the messages.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SharePartitionManager(kafka.server.ReplicaManager replicaManager, org.apache.kafka.common.utils.Time time, org.apache.kafka.server.share.session.ShareSessionCache cache, int defaultRecordLockDurationMs, int maxDeliveryCount, int maxInFlightMessages, int maxFetchRecords, org.apache.kafka.server.share.persister.Persister persister, org.apache.kafka.coordinator.group.GroupConfigManager groupConfigManager, org.apache.kafka.common.metrics.Metrics metrics)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    CompletableFuture<Map<org.apache.kafka.common.TopicIdPartition,org.apache.kafka.common.message.ShareAcknowledgeResponseData.PartitionData>>
    acknowledge(String memberId, String groupId, Map<org.apache.kafka.common.TopicIdPartition,List<org.apache.kafka.server.share.acknowledge.ShareAcknowledgementBatch>> acknowledgeTopics)
    The acknowledge method is used to acknowledge the messages that have been fetched.
    void
    acknowledgeSessionUpdate(String groupId, org.apache.kafka.common.requests.ShareRequestMetadata reqMetadata)
    The acknowledgeSessionUpdate method is used to update the request epoch and lastUsed time of the share session.
    void
     
    CompletableFuture<Map<org.apache.kafka.common.TopicIdPartition,org.apache.kafka.common.message.ShareFetchResponseData.PartitionData>>
    fetchMessages(String groupId, String memberId, org.apache.kafka.server.storage.log.FetchParams fetchParams, Map<org.apache.kafka.common.TopicIdPartition,Integer> partitionMaxBytes)
    The fetch messages method is used to fetch messages from the log for the specified topic-partitions.
    org.apache.kafka.server.share.context.ShareFetchContext
    newContext(String groupId, Map<org.apache.kafka.common.TopicIdPartition,org.apache.kafka.common.requests.ShareFetchRequest.SharePartitionData> shareFetchData, List<org.apache.kafka.common.TopicIdPartition> toForget, org.apache.kafka.common.requests.ShareRequestMetadata reqMetadata, Boolean isAcknowledgeDataPresent)
    The newContext method is used to create a new share fetch context for every share fetch request.
    CompletableFuture<Map<org.apache.kafka.common.TopicIdPartition,org.apache.kafka.common.message.ShareAcknowledgeResponseData.PartitionData>>
    releaseSession(String groupId, String memberId)
    The release session method is used to release the session for the memberId of respective group.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SharePartitionManager

      public SharePartitionManager(kafka.server.ReplicaManager replicaManager, org.apache.kafka.common.utils.Time time, org.apache.kafka.server.share.session.ShareSessionCache cache, int defaultRecordLockDurationMs, int maxDeliveryCount, int maxInFlightMessages, int maxFetchRecords, org.apache.kafka.server.share.persister.Persister persister, org.apache.kafka.coordinator.group.GroupConfigManager groupConfigManager, org.apache.kafka.common.metrics.Metrics metrics)
  • Method Details

    • fetchMessages

      public CompletableFuture<Map<org.apache.kafka.common.TopicIdPartition,org.apache.kafka.common.message.ShareFetchResponseData.PartitionData>> fetchMessages(String groupId, String memberId, org.apache.kafka.server.storage.log.FetchParams fetchParams, Map<org.apache.kafka.common.TopicIdPartition,Integer> partitionMaxBytes)
      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.
      Parameters:
      groupId - The group id, this is used to identify the share group.
      memberId - The member id, generated by the group-coordinator, this is used to identify the client.
      fetchParams - The fetch parameters from the share fetch request.
      partitionMaxBytes - The maximum number of bytes to fetch for each partition.
      Returns:
      A future that will be completed with the fetched messages.
    • acknowledge

      public CompletableFuture<Map<org.apache.kafka.common.TopicIdPartition,org.apache.kafka.common.message.ShareAcknowledgeResponseData.PartitionData>> acknowledge(String memberId, String groupId, Map<org.apache.kafka.common.TopicIdPartition,List<org.apache.kafka.server.share.acknowledge.ShareAcknowledgementBatch>> acknowledgeTopics)
      The acknowledge method is used to acknowledge the messages that have been fetched. The method returns a future that will be completed with the acknowledge response.
      Parameters:
      memberId - The member id, generated by the group-coordinator, this is used to identify the client.
      groupId - The group id, this is used to identify the share group.
      acknowledgeTopics - The acknowledge topics and their corresponding acknowledge batches.
      Returns:
      A future that will be completed with the acknowledge response.
    • releaseSession

      public CompletableFuture<Map<org.apache.kafka.common.TopicIdPartition,org.apache.kafka.common.message.ShareAcknowledgeResponseData.PartitionData>> releaseSession(String groupId, String memberId)
      The release session method is used to release the session for the memberId of respective group. The method post removing session also releases acquired records for the respective member. The method returns a future that will be completed with the release response.
      Parameters:
      groupId - The group id, this is used to identify the share group.
      memberId - The member id, generated by the group-coordinator, this is used to identify the client.
      Returns:
      A future that will be completed with the release response.
    • newContext

      public org.apache.kafka.server.share.context.ShareFetchContext newContext(String groupId, Map<org.apache.kafka.common.TopicIdPartition,org.apache.kafka.common.requests.ShareFetchRequest.SharePartitionData> shareFetchData, List<org.apache.kafka.common.TopicIdPartition> toForget, org.apache.kafka.common.requests.ShareRequestMetadata reqMetadata, Boolean isAcknowledgeDataPresent)
      The newContext method is used to create a new share fetch context for every share fetch request.
      Parameters:
      groupId - The group id in the share fetch request.
      shareFetchData - The topic-partitions and their corresponding maxBytes data in the share fetch request.
      toForget - The topic-partitions to forget present in the share fetch request.
      reqMetadata - The metadata in the share fetch request.
      isAcknowledgeDataPresent - This tells whether the fetch request received includes piggybacked acknowledgements or not
      Returns:
      The new share fetch context object
    • acknowledgeSessionUpdate

      public void acknowledgeSessionUpdate(String groupId, org.apache.kafka.common.requests.ShareRequestMetadata reqMetadata)
      The acknowledgeSessionUpdate method is used to update the request epoch and lastUsed time of the share session.
      Parameters:
      groupId - The group id in the share fetch request.
      reqMetadata - The metadata in the share acknowledge request.
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception