conduktor.io ↗

Kafka Produce Request Wire Format v13 — 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

Request Header v2 · flexible
message_size int32 · 4B
api_key int16 · 2B
api_version int16 · 2B
correlation_id int32 · 4B
client_id? nullable string · int16 length
tagged var
ProduceRequest v13
TransactionalId? string (compact)
Acks int16 · 2B
TimeoutMs int32 · 4B
TopicData array
tagged var
TopicId uuid · 16B
PartitionData array
tagged var
Index int32 · 4B
Records? records (compact)
tagged var

Schema & Example

Schema
{
  "TransactionalId": string?,
  "Acks": int16,
  "TimeoutMs": int32,
  "TopicData": [{
      "TopicId": uuid,
      "PartitionData": [{
          "Index": int32,
          "Records": records?
      }]
  }]
}
Illustrative values (not encoded bytes)
{
  "TransactionalId": "tx-orders-001",
  "Acks": -1,
  "TimeoutMs": 30000,
  "TopicData": [{
      "TopicId": "550e8400-e29b-41d4-a716-446655440000",
      "PartitionData": [{
          "Index": 3,
          "Records": "<binary>"
      }]
  }]
}