You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function uses retry which uses setTimout. It simply calls cb(null), returns and keeps retrying asynchronously.
createTopics(topics, async, cb)
This method is used to create topics on the Kafka server. It only works when auto.create.topics.enable, on the Kafka server, is set to true. Our client simply sends a metadata request to the server which will auto create topics. When async is set to false, this method does not return until all topics are created, otherwise it returns immediately.
topics: Array, array of topics
async: Boolean, async or sync
cb: Function, the callback
Example:
var kafka = require('kafka-node'),
Producer = kafka.Producer,
client = new kafka.Client(),
producer = new Producer(client);
// Create topics sync
producer.createTopics(['t','t1'], false, function (err, data) {
console.log(data);
});
// Create topics async
producer.createTopics(['t'], true, function (err, data) {});
producer.createTopics(['t'], function (err, data) {});// Simply omit 2nd arg
Bug Report
The following implies that calling
producer.createTopics(['x']. false)
blocks the execution until the Kafka's topic is created.Which does not seem to be the case according to https://github.com/SOHU-Co/kafka-node/blob/master/lib/client.js#L369
The function uses
retry
which usessetTimout
. It simply callscb(null)
, returns and keeps retrying asynchronously.Environment
For specific cases also provide
Include Sample Code to reproduce behavior
// include code here
Include output with Debug turned on
Thanks for your contribution!
The text was updated successfully, but these errors were encountered: