const constants = require('./constants_local.json')

var kafka = require('kafka-node');
let client = new kafka.KafkaClient({
    kafkaHost: constants.network.external.kafka_host,
    autoConnect: true
})
var topicsToCreate = [];
for (const [key, value] of Object.entries(constants.topics)) {
    topicsToCreate.push({ topic: value, partitions: 1, replicationFactor: 1 })
}
client.createTopics(topicsToCreate, (error, result) => {
    console.log("topic created", result);
    
});
