Commands | Kafka Topics

The Kafka client can administer topics on the broker. Use CreateTopic(name, partitions, replication) to create a new topic with the given number of partitions and replication factor, and DeleteTopic(name) to remove a topic.

Use GetMetadata([topics]) to retrieve cluster and topic information, such as the brokers, the topics and their partition layout. Pass an empty array to request metadata for the whole cluster.

Basic Usage


// create a topic with 3 partitions and replication factor 1
oKafka.CreateTopic('my-topic', 3, 1);

// request metadata for the topic
oKafka.GetMetadata(['my-topic']);

// delete the topic
oKafka.DeleteTopic('my-topic');