kafka-schema-registry
v1.1.0
Published
module for create kafka-node connection
Downloads
11
Readme
kafka-schema-registry
module for create kafka-node connection.
Installation and Usage
Before installing the package, the Kafka server must be running and Schema-registry or you can running Confluent
Install the package
npm install kafka-schema-registry --save
Require KafkaClient:
const KafkaClient = require('kafka-schema-registry');
const kafkaClient = new KafkaClient({
schemaHost: 'http://your-kafka-host:8081',
kafkaHost: 'your-kafka-host:9092',
topics: [{topic: 'your-topic'}]
});
Producer
const KafkaClient = require('kafka-schema-registry');
const kafkaClient = new KafkaClient({
schemaHost: 'http://localhost:8081',
kafkaHost: 'localhost:9092'
});
kafkaClient.sendMessage(message, topic, name, key);
Consumer
const KafkaClient = require('kafka-schema-registry');
const kafkaClient = new KafkaClient({
schemaHost: 'http://localhost:8081',
kafkaHost: 'localhost:9092',
topics: [{topic: 'your-topic'}]
});
kafkaClient.on('message', (data, err) => {
if (err) console.log(err);
else console.log(data);
});