kafka-consumer-npm
v1.0.8
Published
This is a basic package to consume messages from kafka topic
Downloads
7
Maintainers
Readme
kafka-consumer-npm
This is a basic package to consume messages from kafka topic.
Install
npm install --save kafka-consumer-npm
API
How to use
const kafkaConsumer = require("kafka-consumer-npm");
async function main() {
kafkaConsumer.configure({
brokers: ["localhost:9092"],
saslUser: undefined,
saslPass: undefined,
consumerGroup: "test-consumer-group",
topics: ["TestTopicBySarita"],
autoCommit: true,
allowAutoTopicCreation: false,
readUncommitted: false,
fromBeginning: true
});
await kafkaConsumer.initKafkaConsumer(function(topic, offset, partition, message){
console.log({
topic: topic,
partition: partition,
offset: offset,
value: message,
})
});
await kafkaConsumer.isReady();
}
main();