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.
| Version | Kafka | Changes |
|---|---|---|
| CreateTopicsRequest | ||
| v2 | 2.2 | No changes |
| v3 | 2.2 | No changes |
| v4 | 2.4 | makes partitions/replicationFactor optional even when assignments are not present (KIP-464) |
| v5 | 2.4 | ~ Flexible encoding enabled FLEXIBLE also returns topic configs in the response (KIP-525). |
| v6 | 2.7 | is identical to version 5 but may return a THROTTLING_QUOTA_EXCEEDED error in the response if the topics creation is throttled (KIP-599). |
| v7 | 2.8 | is the same as version 6. |
| CreateTopicsResponse | ||
| v2 | 2.2 | + ThrottleTimeMs int32adds the throttle time. |
| v3 | 2.2 | on quota violation, brokers send out responses before throttling. |
| v4 | 2.4 | makes partitions/replicationFactor optional even when assignments are not present (KIP-464). |
| v5 | 2.4 | + TopicConfigErrorCode int16+ NumPartitions int32+ ReplicationFactor int16+ Configs []CreatableTopicConfigs+ Name string+ Value string+ ReadOnly bool+ ConfigSource int8+ IsSensitive bool~ Flexible encoding enabled FLEXIBLE also returns topic configs in the response (KIP-525). |
| v6 | 2.7 | is identical to version 5 but may return a THROTTLING_QUOTA_EXCEEDED error in the response if the topics creation is throttled (KIP-599). |
| v7 | 2.8 | + TopicId uuidreturns the topic ID of the newly created topic if creation is successful. |