KafkaJS-WS

A modern Apache Kafka client for node.js

MIT License

Downloads
12
Stars
0
Committers
4

Kafka JS WS

About the project

KafkaJS WS is a modern Apache Kafka client for Node js. It is compatible with Kafka 0.10+ offers native support 0.11 features.

Kafka is a registered trademark of The Apache Software Foundation and has been licensed for use by KafkaJS. KafkaJS has no affiliation with and is not endorsed by The Apache Software Foundation.

Features

It use Socket.IO, it consists of:

  • a Node.js server (this repository)
  • a Javascript client library for the browser (or a Node.js client)

Example Usage


import { Confluent, Consumer, Subject } from "kafkajs-ws";
import { randomBytes } from "crypto";

const io = new Server(res.socket.server, {
    cors: {
      origin: "*",
      methods: ["GET", "POST"],
      credentials: true
    },
});

const kafka = new Confluent(
    "",
    "",
    KAFKA_BROKERS as string[],
  ).create("client-id");

const groupId = "test-consumer-group-" + randomBytes(16).toString("base64");
const kafkaConsumer = kafka.consumer({ groupId: groupId });
const kafkaSocksConsumer = new Consumer(kafkaConsumer, 'consumer_topic', 'event_name');
const kafkaSocksSubject = new Subject(io, '');
kafkaSocksSubject.add(kafkaSocksConsumer);
kafkaSocksSubject.connect();
//

Documentation

Please see the documnetation here

Package Rankings
Top 22.31% on Npmjs.org
Badges
Extracted from project README
Run on Repl.it Publish Package to npmjs