You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
540 B
20 lines
540 B
2 years ago
|
'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");
|
||
|
}
|