conduktor.io ↗

Kafka CreateTopics Request Wire Format v7 — Binary Protocol Layout

What is CreateTopics?

Provisions new topics via kafka-topics.sh --create or AdminClient.createTopics(). The validateOnly flag lets CI pipelines check if a topic config is valid without creating it; NOT_CONTROLLER errors mean the request hit a non-controller broker and will be auto-retried.

Related Errors

INVALID_PARTITIONS · INVALID_REPLICATION_FACTOR · NOT_CONTROLLER · POLICY_VIOLATION · THROTTLING_QUOTA_EXCEEDED · TOPIC_ALREADY_EXISTS

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
CreateTopicsRequest v7
Topics array
timeoutMs int32 · 4B
validateOnly bool · 1B
tagged var
Name string (compact)
NumPartitions int32 · 4B
ReplicationFactor int16 · 2B
Assignments array
Configs array
tagged var
PartitionIndex int32 · 4B
BrokerIds []int32
tagged var
Name string (compact)
Value? string (compact)
tagged var

Schema & Example

Schema
{
  "Topics": [{
      "Name": string,
      "NumPartitions": int32,
      "ReplicationFactor": int16,
      "Assignments": [{
          "PartitionIndex": int32,
          "BrokerIds": [int32]
      }],
      "Configs": [{
          "Name": string,
          "Value": string?
      }]
  }],
  "timeoutMs": int32,
  "validateOnly": bool
}
Example
{
  "Topics": [{
      "Name": "orders",
      "NumPartitions": 0,
      "ReplicationFactor": 1,
      "Assignments": [{
          "PartitionIndex": 3,
          "BrokerIds": [1, 2, 3]
      }],
      "Configs": [{
          "Name": "orders",
          "Value": null
      }]
  }],
  "timeoutMs": 30000,
  "validateOnly": true
}