new AdminClient(conf)
AdminClient class for administering Kafka
This client is the way you can interface with the Kafka Admin APIs.
This class should not be made using the constructor, but instead
should be made using the factory method.
var client = AdminClient.create({ ... });
Once you instantiate this object, it will have a handle to the kafka broker.
Unlike the other node-rdkafka classes, this class does not ensure that
it is connected to the upstream broker. Instead, making an action will
validate that.
Parameters:
Name | Type | Description |
---|---|---|
conf | object | Key value pairs to configure the admin client topic configuration |
- Source:
Methods:
connect()
Connect using the admin client. Should be run using the factory method, so should never need to be called outside. Unlike the other connect methods, this one is synchronous.
- Source:
createPartitions(topic, totalPartitions, timeout, cb)
Create new partitions for a topic.
Parameters:
Name | Type | Description |
---|---|---|
topic | string | The topic to add partitions to, by name. |
totalPartitions | number | The total number of partitions the topic should have after the request |
timeout | number | Number of milliseconds to wait while trying to delete the topic. |
cb | function | The callback to be executed when finished |
- Source:
createTopic(topic, timeout, cb)
Create a topic with a given config.
Parameters:
Name | Type | Description |
---|---|---|
topic | NewTopic | Topic to create. |
timeout | number | Number of milliseconds to wait while trying to create the topic. |
cb | function | The callback to be executed when finished |
- Source:
deleteTopic(topic, timeout, cb)
Delete a topic.
Parameters:
Name | Type | Description |
---|---|---|
topic | string | The topic to delete, by name. |
timeout | number | Number of milliseconds to wait while trying to delete the topic. |
cb | function | The callback to be executed when finished |
- Source:
disconnect()
Disconnect the admin client. This is a synchronous method, but all it does is clean up some memory and shut some threads down
- Source:
Type Definitions:
NewTopic
NewTopic model. This is the representation of a new message that is requested to be made using the Admin client.
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
topic | string | the topic name to create |
num_partitions | number | the number of partitions to give the topic |
replication_factor | number | the replication factor of the topic |
config | object | a list of key values to be passed as configuration for the topic. |
- Source: