For Kafka, the cluster defines how / if you can create themes. If you want to be able to create themes on the fly, the easiest way to use auto.create.topics.enable in your cluster. Then, when you post to a topic that does not exist, the cluster creates a topic with the default sections of the cluster and replication rate. If you do not have / this feature enabled, there are no methods in the Kafka client library that I know of.
If you decide, you can look into the insides of kafka-topics.sh , in which you will find Kafka creates themes with the main api.
David krieg
source share