kafka-node-topic-connector
v1.0.1
Published
wrapper around kafka-node's consumer and producer, privide live stream for working with kafa topic
Downloads
5
Maintainers
Readme
kafka-node-topic-connector library is a high-performance NodeJS client for Apache Kafka
it works with rxjs change steam to Observable Stream also include redix to remember the last offset key
const { map } = require("rxjs/operators");
const util = require("../util");
const config = require("../config"); // your config for connect to kafka
const KafkaConnector = require('kafka-node-topic-connector');
const log = require("./operators/log");
const pushMessageBackToKafka = require("./pushMessageBackToKafka");
const kafkaConnector = new KafkaConnector(config.kafka);
const kafkaStream = kafkaConnector.createObservableStream();
const source = kafkaStream
.pipe(map(util.deserialize))
.pipe(log('after util.deserialize'))
//do some procesing here
//after could push messages back to kafka
.pipe(pushMessageBackToKafka(kafkaConnector))
module.exports = source;
const source = require("./stream");
const util = require("./util");
source.subscribe(...util.observer);