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.
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
timeoutMs
int32 · 4B
validateOnly
bool · 1B
tagged
var
Name
string (compact)
NumPartitions
int32 · 4B
ReplicationFactor
int16 · 2B
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": "604800000" }] }], "timeoutMs": 30000, "validateOnly": true }