ShareFetch
This page encodes the smallest legal instance of the request and the response: numeric fields are zero, strings and byte arrays are empty, every array carries exactly one sample element, and any records field holds one empty 61-byte RecordBatch v2. Version 0 is a flexible version, so every struct is terminated by a uvarint tagged-field count and strings and arrays carry compact length-plus-one prefixes. Sizes below include the leading int32 size prefix.
- API key
- 78
- Encoded at
- v0
- Flexible versions
- 0+
- Headers
- req v2, resp v1
- Request versions
- 0
- Response versions
- 0
- Request size
- 105 bytes
- Response size
- 150 bytes
framerpc headerrequest bodyRecordBatchRecordresponse bodytagged_fields
Request
ShareFetchRequest v0, request header v2, 105 bytes on the wire
byte layout (105 bytes, 16 bytes per row)
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010
0020
0030
0040
0050
0060
object tree
ShareFetchRequest message v0 [0x0000, 105B] +-- Frame [0x0000, 4B] length-delimited framing | +-- size int32 = 101 [0x0000, 4B] number of bytes that follow, patched after encoding +-- RequestHeader v2 [0x0004, 11B] common request header | +-- request_api_key int16 = 78 (ShareFetch) [0x0004, 2B] numeric id of the API being invoked | +-- request_api_version int16 = 0 [0x0006, 2B] version of the API being invoked | +-- correlation_id int32 = 0 [0x0008, 4B] echoed back by the broker in the response | +-- client_id nullable_string = "" (int16 len=0) [0x000c, 2B] always a non-flexible int16-prefixed string | +-- tagged_fields uvarint = 0 [0x000e, 1B] number of tagged fields in the header +-- ShareFetchRequest struct [0x000f, 90B] message body, version 0 +-- GroupId string = "" (compact, len+1=1) [0x000f, 1B] The group identifier. +-- MemberId string = "" (compact, len+1=1) [0x0010, 1B] The member ID. +-- ShareSessionEpoch int32 = 0 [0x0011, 4B] The current share session epoch: 0 to open a share session; -1 to close it;... +-- MaxWaitMs int32 = 0 [0x0015, 4B] The maximum time in milliseconds to wait for the response. +-- MinBytes int32 = 0 [0x0019, 4B] The minimum bytes to accumulate in the response. +-- MaxBytes int32 = 0 [0x001d, 4B] The maximum bytes to fetch. See KIP-74 for cases where this limit may not b... +-- Topics []FetchTopic = 1 element [0x0021, 48B] The topics to fetch. | +-- length uvarint = 2 (compact, n+1) [0x0021, 1B] one sample element follows | +-- FetchTopic[0] FetchTopic = struct [0x0022, 47B] | +-- TopicId uuid = 00000000-0000-0000-0000-000000000000 [0x0022, 16B] The unique topic ID. | +-- Partitions []FetchPartition = 1 element [0x0032, 30B] The partitions to fetch. | | +-- length uvarint = 2 (compact, n+1) [0x0032, 1B] one sample element follows | | +-- FetchPartition[0] FetchPartition = struct [0x0033, 29B] | | +-- PartitionIndex int32 = 0 [0x0033, 4B] The partition index. | | +-- PartitionMaxBytes int32 = 0 [0x0037, 4B] The maximum bytes to fetch from this partition. 0 when only acknowledgement... | | +-- AcknowledgementBatches []AcknowledgementBatch = 1 element [0x003b, 20B] Record batches to acknowledge. | | | +-- length uvarint = 2 (compact, n+1) [0x003b, 1B] one sample element follows | | | +-- AcknowledgementBatch[0] AcknowledgementBatch = struct [0x003c, 19B] | | | +-- FirstOffset int64 = 0 [0x003c, 8B] First offset of batch of records to acknowledge. | | | +-- LastOffset int64 = 0 [0x0044, 8B] Last offset (inclusive) of batch of records to acknowledge. | | | +-- AcknowledgeTypes []int8 = 1 element [0x004c, 2B] Array of acknowledge types - 0:Gap,1:Accept,2:Release,3:Reject. | | | | +-- length uvarint = 2 (compact, n+1) [0x004c, 1B] one sample element follows | | | | +-- int8[0] int8 = 0 [0x004d, 1B] | | | +-- tagged_fields uvarint = 0 [0x004e, 1B] number of tagged fields in this struct | | +-- tagged_fields uvarint = 0 [0x004f, 1B] number of tagged fields in this struct | +-- tagged_fields uvarint = 0 [0x0050, 1B] number of tagged fields in this struct +-- ForgottenTopicsData []ForgottenTopic = 1 element [0x0051, 23B] The partitions to remove from this share session. | +-- length uvarint = 2 (compact, n+1) [0x0051, 1B] one sample element follows | +-- ForgottenTopic[0] ForgottenTopic = struct [0x0052, 22B] | +-- TopicId uuid = 00000000-0000-0000-0000-000000000000 [0x0052, 16B] The unique topic ID. | +-- Partitions []int32 = 1 element [0x0062, 5B] The partitions indexes to forget. | | +-- length uvarint = 2 (compact, n+1) [0x0062, 1B] one sample element follows | | +-- int32[0] int32 = 0 [0x0063, 4B] | +-- tagged_fields uvarint = 0 [0x0067, 1B] number of tagged fields in this struct +-- tagged_fields uvarint = 0 [0x0068, 1B] number of tagged fields in this struct
kafka message schema (.json)
{ "apiKey": 78, "type": "request", "listeners": ["broker"], "name": "ShareFetchRequest", "validVersions": "0", "flexibleVersions": "0+", // The ShareFetchRequest API is added as part of KIP-932 and is still under // development. Hence, the API is not exposed by default by brokers unless // explicitly enabled. "latestVersionUnstable": true, "fields": [ { "name": "GroupId", "type": "string", "versions": "0+", "nullableVersions": "0+", "default": "null", "entityType": "groupId", "about": "The group identifier." }, { "name": "MemberId", "type": "string", "versions": "0+", "nullableVersions": "0+", "about": "The member ID." }, { "name": "ShareSessionEpoch", "type": "int32", "versions": "0+", "about": "The current share session epoch: 0 to open a share session; -1 to close it; otherwise increments for consecutive requests." }, { "name": "MaxWaitMs", "type": "int32", "versions": "0+", "about": "The maximum time in milliseconds to wait for the response." }, { "name": "MinBytes", "type": "int32", "versions": "0+", "about": "The minimum bytes to accumulate in the response." }, { "name": "MaxBytes", "type": "int32", "versions": "0+", "default": "0x7fffffff", "about": "The maximum bytes to fetch. See KIP-74 for cases where this limit may not be honored." }, { "name": "Topics", "type": "[]FetchTopic", "versions": "0+", "about": "The topics to fetch.", "fields": [ { "name": "TopicId", "type": "uuid", "versions": "0+", "about": "The unique topic ID."}, { "name": "Partitions", "type": "[]FetchPartition", "versions": "0+", "about": "The partitions to fetch.", "fields": [ { "name": "PartitionIndex", "type": "int32", "versions": "0+", "about": "The partition index." }, { "name": "PartitionMaxBytes", "type": "int32", "versions": "0+", "about": "The maximum bytes to fetch from this partition. 0 when only acknowledgement with no fetching is required. See KIP-74 for cases where this limit may not be honored." }, { "name": "AcknowledgementBatches", "type": "[]AcknowledgementBatch", "versions": "0+", "about": "Record batches to acknowledge.", "fields": [ { "name": "FirstOffset", "type": "int64", "versions": "0+", "about": "First offset of batch of records to acknowledge."}, { "name": "LastOffset", "type": "int64", "versions": "0+", "about": "Last offset (inclusive) of batch of records to acknowledge."}, { "name": "AcknowledgeTypes", "type": "[]int8", "versions": "0+", "about": "Array of acknowledge types - 0:Gap,1:Accept,2:Release,3:Reject."} ]} ]} ]}, { "name": "ForgottenTopicsData", "type": "[]ForgottenTopic", "versions": "0+", "about": "The partitions to remove from this share session.", "fields": [ { "name": "TopicId", "type": "uuid", "versions": "0+", "about": "The unique topic ID."}, { "name": "Partitions", "type": "[]int32", "versions": "0+", "about": "The partitions indexes to forget." } ]} ] }
Response
ShareFetchResponse v0, response header v1, 150 bytes on the wire
byte layout (150 bytes, 16 bytes per row)
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010
0020
0030
0040
0050
0060
0070
0080
0090
object tree
ShareFetchResponse message v0 [0x0000, 150B] +-- Frame [0x0000, 4B] length-delimited framing | +-- size int32 = 146 [0x0000, 4B] number of bytes that follow, patched after encoding +-- ResponseHeader v1 [0x0004, 5B] common response header | +-- correlation_id int32 = 0 [0x0004, 4B] matches the correlation_id of the request | +-- tagged_fields uvarint = 0 [0x0008, 1B] number of tagged fields in the header +-- ShareFetchResponse struct [0x0009, 141B] message body, version 0 +-- ThrottleTimeMs int32 = 0 [0x0009, 4B] The duration in milliseconds for which the request was throttled due to a q... +-- ErrorCode int16 = 0 [0x000d, 2B] The top-level response error code. +-- ErrorMessage string = "" (compact, len+1=1) [0x000f, 1B] The top-level error message, or null if there was no error. +-- Responses []ShareFetchableTopicResponse = 1 element [0x0010, 121B] The response topics. | +-- length uvarint = 2 (compact, n+1) [0x0010, 1B] one sample element follows | +-- ShareFetchableTopicResponse[0] ShareFetchableTopicResponse = struct [0x0011, 120B] | +-- TopicId uuid = 00000000-0000-0000-0000-000000000000 [0x0011, 16B] The unique topic ID. | +-- Partitions []PartitionData = 1 element [0x0021, 103B] The topic partitions. | | +-- length uvarint = 2 (compact, n+1) [0x0021, 1B] one sample element follows | | +-- PartitionData[0] PartitionData = struct [0x0022, 102B] | | +-- PartitionIndex int32 = 0 [0x0022, 4B] The partition index. | | +-- ErrorCode int16 = 0 [0x0026, 2B] The fetch error code, or 0 if there was no fetch error. | | +-- ErrorMessage string = "" (compact, len+1=1) [0x0028, 1B] The fetch error message, or null if there was no fetch error. | | +-- AcknowledgeErrorCode int16 = 0 [0x0029, 2B] The acknowledge error code, or 0 if there was no acknowledge error. | | +-- AcknowledgeErrorMessage string = "" (compact, len+1=1) [0x002b, 1B] The acknowledge error message, or null if there was no acknowledge error. | | +-- CurrentLeader LeaderIdAndEpoch = struct [0x002c, 9B] The current leader of the partition. | | | +-- LeaderId int32 = 0 [0x002c, 4B] The ID of the current leader or -1 if the leader is unknown. | | | +-- LeaderEpoch int32 = 0 [0x0030, 4B] The latest known leader epoch. | | | +-- tagged_fields uvarint = 0 [0x0034, 1B] number of tagged fields in this struct | | +-- Records records = 1 RecordBatch [0x0035, 62B] The record data. | | | +-- length uvarint = 62 (compact, n+1) [0x0035, 1B] size of the record set in bytes | | | +-- RecordBatch v2 = empty [0x0036, 61B] fixed 61-byte RecordBatch v2 header, zero records | | | +-- baseOffset int64 = 0 [0x0036, 8B] offset of the first record in the batch | | | +-- batchLength int32 = 49 [0x003e, 4B] bytes after this field to the end of the batch | | | +-- partitionLeaderEpoch int32 = -1 [0x0042, 4B] leader epoch, -1 when produced by a client | | | +-- magic int8 = 2 [0x0046, 1B] record format version, 2 | | | +-- crc uint32 = crc32c of the bytes that follow [0x0047, 4B] CRC-32C over attributes .. end of batch | | | +-- attributes int16 = 0 [0x004b, 2B] compression, timestamp type, txn and control flags | | | +-- lastOffsetDelta int32 = -1 [0x004d, 4B] offset delta of the last record, -1 when empty | | | +-- baseTimestamp int64 = -1 [0x0051, 8B] timestamp of the first record | | | +-- maxTimestamp int64 = -1 [0x0059, 8B] largest timestamp in the batch | | | +-- producerId int64 = -1 [0x0061, 8B] producer id, -1 when non-idempotent | | | +-- producerEpoch int16 = -1 [0x0069, 2B] producer epoch, -1 when non-idempotent | | | +-- baseSequence int32 = -1 [0x006b, 4B] sequence of the first record, -1 when non-idempotent | | | +-- recordsCount int32 = 0 [0x006f, 4B] number of records that follow, 0 here | | +-- AcquiredRecords []AcquiredRecords = 1 element [0x0073, 20B] The acquired records. | | | +-- length uvarint = 2 (compact, n+1) [0x0073, 1B] one sample element follows | | | +-- AcquiredRecords[0] AcquiredRecords = struct [0x0074, 19B] | | | +-- FirstOffset int64 = 0 [0x0074, 8B] The earliest offset in this batch of acquired records. | | | +-- LastOffset int64 = 0 [0x007c, 8B] The last offset of this batch of acquired records. | | | +-- DeliveryCount int16 = 0 [0x0084, 2B] The delivery count of this batch of acquired records. | | | +-- tagged_fields uvarint = 0 [0x0086, 1B] number of tagged fields in this struct | | +-- tagged_fields uvarint = 0 [0x0087, 1B] number of tagged fields in this struct | +-- tagged_fields uvarint = 0 [0x0088, 1B] number of tagged fields in this struct +-- NodeEndpoints []NodeEndpoint = 1 element [0x0089, 12B] Endpoints for all current leaders enumerated in PartitionData with error NO... | +-- length uvarint = 2 (compact, n+1) [0x0089, 1B] one sample element follows | +-- NodeEndpoint[0] NodeEndpoint = struct [0x008a, 11B] | +-- NodeId int32 = 0 [0x008a, 4B] The ID of the associated node. | +-- Host string = "" (compact, len+1=1) [0x008e, 1B] The node's hostname. | +-- Port int32 = 0 [0x008f, 4B] The node's port. | +-- Rack string = "" (compact, len+1=1) [0x0093, 1B] The rack of the node, or null if it has not been assigned to a rack. | +-- tagged_fields uvarint = 0 [0x0094, 1B] number of tagged fields in this struct +-- tagged_fields uvarint = 0 [0x0095, 1B] number of tagged fields in this struct
kafka message schema (.json)
{ "apiKey": 78, "type": "response", "name": "ShareFetchResponse", "validVersions": "0", "flexibleVersions": "0+", // Supported errors for ErrorCode and AcknowledgeErrorCode: // - GROUP_AUTHORIZATION_FAILED (version 0+) // - TOPIC_AUTHORIZATION_FAILED (version 0+) // - SHARE_SESSION_NOT_FOUND (version 0+) // - INVALID_SHARE_SESSION_EPOCH (version 0+) // - UNKNOWN_TOPIC_OR_PARTITION (version 0+) // - NOT_LEADER_OR_FOLLOWER (version 0+) // - UNKNOWN_TOPIC_ID (version 0+) // - INVALID_RECORD_STATE (version 0+) - only for AcknowledgeErrorCode // - KAFKA_STORAGE_ERROR (version 0+) // - CORRUPT_MESSAGE (version 0+) // - INVALID_REQUEST (version 0+) // - UNKNOWN_SERVER_ERROR (version 0+) "fields": [ { "name": "ThrottleTimeMs", "type": "int32", "versions": "0+", "about": "The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota." }, { "name": "ErrorCode", "type": "int16", "versions": "0+", "about": "The top-level response error code." }, { "name": "ErrorMessage", "type": "string", "versions": "0+", "nullableVersions": "0+", "default": "null", "about": "The top-level error message, or null if there was no error." }, { "name": "Responses", "type": "[]ShareFetchableTopicResponse", "versions": "0+", "about": "The response topics.", "fields": [ { "name": "TopicId", "type": "uuid", "versions": "0+", "about": "The unique topic ID."}, { "name": "Partitions", "type": "[]PartitionData", "versions": "0+", "about": "The topic partitions.", "fields": [ { "name": "PartitionIndex", "type": "int32", "versions": "0+", "about": "The partition index." }, { "name": "ErrorCode", "type": "int16", "versions": "0+", "about": "The fetch error code, or 0 if there was no fetch error." }, { "name": "ErrorMessage", "type": "string", "versions": "0+", "nullableVersions": "0+", "default": "null", "about": "The fetch error message, or null if there was no fetch error." }, { "name": "AcknowledgeErrorCode", "type": "int16", "versions": "0+", "about": "The acknowledge error code, or 0 if there was no acknowledge error." }, { "name": "AcknowledgeErrorMessage", "type": "string", "versions": "0+", "nullableVersions": "0+", "default": "null", "about": "The acknowledge error message, or null if there was no acknowledge error." }, { "name": "CurrentLeader", "type": "LeaderIdAndEpoch", "versions": "0+", "about": "The current leader of the partition.", "fields": [ { "name": "LeaderId", "type": "int32", "versions": "0+", "about": "The ID of the current leader or -1 if the leader is unknown." }, { "name": "LeaderEpoch", "type": "int32", "versions": "0+", "about": "The latest known leader epoch." } ]}, { "name": "Records", "type": "records", "versions": "0+", "nullableVersions": "0+", "about": "The record data."}, { "name": "AcquiredRecords", "type": "[]AcquiredRecords", "versions": "0+", "about": "The acquired records.", "fields": [ {"name": "FirstOffset", "type": "int64", "versions": "0+", "about": "The earliest offset in this batch of acquired records."}, {"name": "LastOffset", "type": "int64", "versions": "0+", "about": "The last offset of this batch of acquired records."}, {"name": "DeliveryCount", "type": "int16", "versions": "0+", "about": "The delivery count of this batch of acquired records."} ]} ]} ]}, { "name": "NodeEndpoints", "type": "[]NodeEndpoint", "versions": "0+", "about": "Endpoints for all current leaders enumerated in PartitionData with error NOT_LEADER_OR_FOLLOWER.", "fields": [ { "name": "NodeId", "type": "int32", "versions": "0+", "mapKey": true, "entityType": "brokerId", "about": "The ID of the associated node." }, { "name": "Host", "type": "string", "versions": "0+", "about": "The node's hostname." }, { "name": "Port", "type": "int32", "versions": "0+", "about": "The node's port." }, { "name": "Rack", "type": "string", "versions": "0+", "nullableVersions": "0+", "default": "null", "about": "The rack of the node, or null if it has not been assigned to a rack." } ]} ] }