Package kafka.server.share
Class SharePartitionManager
java.lang.Object
kafka.server.share.SharePartitionManager
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionSharePartitionManager
(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 TypeMethodDescriptionCompletableFuture
<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
close()
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.
-
Constructor Details
-
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.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-