conduktor.io ↗

Kafka Produce Response Wire Format v11 — Binary Protocol Layout

What is Produce?

A producer request can carry record batches for multiple partitions. Acknowledgement behavior depends on acks, replication and the minimum ISR: acks=all waits for the required in-sync replication, while acks=1 can acknowledge before followers replicate the write. Retries and application error handling still matter; a larger batch does not imply a proportional throughput gain.

Related Errors

CORRUPT_MESSAGE · DUPLICATE_SEQUENCE_NUMBER · INVALID_PRODUCER_EPOCH · INVALID_RECORD · INVALID_REQUIRED_ACKS · INVALID_TIMESTAMP · INVALID_TXN_STATE · LEADER_NOT_AVAILABLE · MESSAGE_TOO_LARGE · NETWORK_EXCEPTION · NOT_ENOUGH_REPLICAS · NOT_ENOUGH_REPLICAS_AFTER_APPEND · NOT_LEADER_OR_FOLLOWER · OUT_OF_ORDER_SEQUENCE_NUMBER · RECORD_LIST_TOO_LARGE · TOPIC_AUTHORIZATION_FAILED · TRANSACTIONAL_ID_AUTHORIZATION_FAILED · TRANSACTION_COORDINATOR_FENCED · UNKNOWN_PRODUCER_ID · UNKNOWN_TOPIC_ID · UNKNOWN_TOPIC_OR_PARTITION · UNSUPPORTED_FOR_MESSAGE_FORMAT

Wire Diagram

Response Header v1 · flexible
message_size int32 · 4B
correlation_id int32 · 4B
tagged var
ProduceResponse v11
Responses array
ThrottleTimeMs int32 · 4B
tagged var
Name string (compact)
PartitionResponses array
tagged var
Index int32 · 4B
ErrorCode int16 · 2B
BaseOffset int64 · 8B
LogAppendTimeMs int64 · 8B
LogStartOffset int64 · 8B
RecordErrors array
ErrorMessage? string (compact)
tagged var
BatchIndex int32 · 4B
BatchIndexErrorMessage? string (compact)
tagged var
Known optional payloads inside tagged buffer
tag 0: CurrentLeader LeaderIdAndEpoch
Known optional payloads inside tagged buffer
tag 0: NodeEndpoints []NodeEndpoint

Schema & Example

Schema
{
  "Responses": [{
      "Name": string,
      "PartitionResponses": [{
          "Index": int32,
          "ErrorCode": int16,
          "BaseOffset": int64,
          "LogAppendTimeMs": int64,
          "LogStartOffset": int64,
          "RecordErrors": [{
              "BatchIndex": int32,
              "BatchIndexErrorMessage": string?
          }],
          "ErrorMessage": string?,
          "CurrentLeader": {
            "LeaderId": int32,
            "LeaderEpoch": int32
          }
      }]
  }],
  "ThrottleTimeMs": int32,
  "NodeEndpoints": [{
      "NodeId": int32,
      "Host": string,
      "Port": int32,
      "Rack": string?
  }]
}
Illustrative values (not encoded bytes)
{
  "Responses": [{
      "Name": "orders",
      "PartitionResponses": [{
          "Index": 3,
          "ErrorCode": 0,
          "BaseOffset": 284729,
          "LogAppendTimeMs": 1711648200000,
          "LogStartOffset": 284729,
          "RecordErrors": [{
              "BatchIndex": 0,
              "BatchIndexErrorMessage": "NETWORK_EXCEPTION"
          }],
          "ErrorMessage": null,
          "CurrentLeader": {
            "LeaderId": 1,
            "LeaderEpoch": 17
          }
      }]
  }],
  "ThrottleTimeMs": 0,
  "NodeEndpoints": [{
      "NodeId": 1,
      "Host": "broker-1.kafka.local",
      "Port": 9092,
      "Rack": "us-east-1a"
  }]
}