conduktor.io ↗

Kafka Produce Request Wire Format v3 — Binary Protocol Layout

What is Produce?

Every producer sends this for every message publish, making it the dominant write path. With acks=all, the broker waits for all ISR replicas to acknowledge before responding; acks=1 returns after the leader writes locally; acks=0 is fire-and-forget with no loss detection.

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 · THROTTLING_QUOTA_EXCEEDED · 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

Request Header
message_size int32 · 4B
api_key int16 · 2B
api_version int16 · 2B
correlation_id int32 · 4B
client_id string
ProduceRequest v3
TransactionalId? string
Acks int16 · 2B
TimeoutMs int32 · 4B
TopicData array
Name string
PartitionData array
Index int32 · 4B
Records? records

Schema & Example

Schema
{
  "TransactionalId": string?,
  "Acks": int16,
  "TimeoutMs": int32,
  "TopicData": [{
      "Name": string,
      "PartitionData": [{
          "Index": int32,
          "Records": records?
      }]
  }]
}
Example
{
  "TransactionalId": "tx-orders-001",
  "Acks": -1,
  "TimeoutMs": 30000,
  "TopicData": [{
      "Name": "orders",
      "PartitionData": [{
          "Index": 3,
          "Records": "<binary>"
      }]
  }]
}