conduktor.io ↗

Kafka ShareFetch Request Wire Format v2 — Binary Protocol Layout

What is ShareFetch?

The main data path for share group consumers, fetching records and acknowledging previously fetched ones in a single round-trip (KIP-932). Records are locked on fetch with an acquisition timeout; if a consumer doesn't acknowledge within that window, the records become available for re-delivery.

Related Errors

FENCED_STATE_EPOCH · GROUP_AUTHORIZATION_FAILED · INVALID_REQUEST · INVALID_SHARE_SESSION_EPOCH · SHARE_SESSION_LIMIT_REACHED · SHARE_SESSION_NOT_FOUND · UNSUPPORTED_VERSION

Wire Diagram

Request Header · flexible
message_size int32 · 4B
api_key int16 · 2B
api_version int16 · 2B
correlation_id int32 · 4B
client_id string (compact)
tagged var
ShareFetchRequest v2
GroupId? string (compact)
MemberId? string (compact)
ShareSessionEpoch int32 · 4B
MaxWaitMs int32 · 4B
MinBytes int32 · 4B
MaxBytes int32 · 4B
MaxRecords int32 · 4B
BatchSize int32 · 4B
ShareAcquireMode int8 · 1B
IsRenewAck bool · 1B
Topics array
ForgottenTopicsData array
tagged var
TopicId uuid · 16B
Partitions array
tagged var
PartitionIndex int32 · 4B
AcknowledgementBatches array
tagged var
FirstOffset int64 · 8B
LastOffset int64 · 8B
AcknowledgeTypes []int8
tagged var
TopicId uuid · 16B
Partitions []int32
tagged var

Schema & Example

Schema
{
  "GroupId": string?,
  "MemberId": string?,
  "ShareSessionEpoch": int32,
  "MaxWaitMs": int32,
  "MinBytes": int32,
  "MaxBytes": int32,
  "MaxRecords": int32,
  "BatchSize": int32,
  "ShareAcquireMode": int8,
  "IsRenewAck": bool,
  "Topics": [{
      "TopicId": uuid,
      "Partitions": [{
          "PartitionIndex": int32,
          "AcknowledgementBatches": [{
              "FirstOffset": int64,
              "LastOffset": int64,
              "AcknowledgeTypes": [int8]
          }]
      }]
  }],
  "ForgottenTopicsData": [{
      "TopicId": uuid,
      "Partitions": [int32]
  }]
}
Example
{
  "GroupId": "order-processors",
  "MemberId": null,
  "ShareSessionEpoch": 12,
  "MaxWaitMs": 500,
  "MinBytes": 65536,
  "MaxBytes": 65536,
  "MaxRecords": 0,
  "BatchSize": 1048576,
  "ShareAcquireMode": 1,
  "IsRenewAck": true,
  "Topics": [{
      "TopicId": "550e8400-e29b-41d4-a716-446655440000",
      "Partitions": [{
          "PartitionIndex": 3,
          "AcknowledgementBatches": [{
              "FirstOffset": 150382,
              "LastOffset": 150382,
              "AcknowledgeTypes": [...]
          }]
      }]
  }],
  "ForgottenTopicsData": [{
      "TopicId": "550e8400-e29b-41d4-a716-446655440000",
      "Partitions": [1, 2, 3]
  }]
}