kafka-python icon indicating copy to clipboard operation
kafka-python copied to clipboard

API to create a topic with a particular number of partitions

Open mjwillson opened this issue 12 years ago • 4 comments

Is it possible to use this client library to create a topic with a particular number of partitions, like the kafka-create-topic.sh script which ships with kafka allows? I couldn't spot any API for this (or even to create a topic at all!)

It can be useful to do this programmatically, e.g. when setting up system/integration tests.

mjwillson avatar Aug 22 '14 13:08 mjwillson

Topics are automatically lazily by Kafka. If you start producing to it, it will be created with some defaults defined by the broker. I believe those scripts in the Kafka dist talk to ZK directly to update topic/partition metadata. We only talk to Kafka through the published APIs, so we can't do that. It might be worth asking about this on the kafka-user list to see if there is a way to create a topic with N partitions through the API

mumrah avatar Aug 22 '14 13:08 mumrah

I don't see any API for creating topics (https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol) . You might pop onto the kafka mailing lists (http://kafka.apache.org/contact.html) and see if there are any plans to add this to the server API.

dpkp avatar Aug 22 '14 17:08 dpkp

Interesting. OK cheers for the pointers!

On Fri, Aug 22, 2014 at 6:05 PM, Dana Powers [email protected] wrote:

I don't see any API for creating topics ( https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol) . You might pop onto the kafka mailing lists ( http://kafka.apache.org/contact.html) and see if there are any plans to add this to the server API.

— Reply to this email directly or view it on GitHub https://github.com/mumrah/kafka-python/issues/202#issuecomment-53090066.

mjwillson avatar Aug 22 '14 18:08 mjwillson

Is this possible now? Is there a way to create a topic with n partitions using the API?

himaprasoon avatar Jun 28 '18 15:06 himaprasoon