kafka-client
v3.0.0
Published
A javascript client for kafka
Downloads
114
Readme
kafka-client
A javascript client for kafka
Why the client
The purpose of this client has been to get hands on experience with kafka.
This client does not interact with Kafka directly but relies on kafka-node for this interaction.
It is more focused on simplifying the API interface rather than the technical with a kafka cluster.
There are other node libraries to interact with kafka such as node-rdkafka.
By using this client it will possible to switch to using a different kafka interaction package in the future without having to change upstream code. For instance if kafka-rdnode evolves faster than kafka-node
Getting started
Get a client
var client = await client.connect();
View Topics
var topics = await client.getTopics();
Creating a Topic
await client.createTopic(topic);
Produce a simple message
await client.produce(key,value,topic);
Consuming a message
//Establish a message consumer for a group on a topic
var consumeMessage = await client.singleMessageConsumer(group,topic);
//Then wait for a message
var result = await consumeMessage();
Useful Reference
Getting Started with Kafka Client