'use strict'; const Kafka = require('kafka-node'); module.exports = async function factory (app, opts) { const client = new Kafka.KafkaClient({ kafkaHost: opts.kafka.rootURL }); const producer = new Kafka.HighLevelProducer(client); producer.on('error', function (err) { app.fs.logger.log('error', "[FS-KAFKA]", err); }); const kafka = { producer: producer, configUpdateMessage: opts.configUpdateMessage || {} }; app.fs.kafka = kafka; app.fs.logger.log('debug', "[FS-KAFKA]", "Init.Success"); }