The most advanced Kafka Client.
- easy promise based API
- a lot of Kafka pitfalls already taken care of
- backpressure and stream consume modes
- secure committing in backpressure (1:n, batch) mode
- plain Javascript implementation based on
kafka-node
and a super fast native implementation based onnode-rdkafka
- SSL, SASL & Kerberos support
- auto reconnects
- auto partition recognition and deterministic spreading for producers
- intelligent health-checks and analytic events for consumers and producers
- check out
node-kafka-streams for a stream processing kafka api
- check out ๐ฅ node-kafka-connect for a easy datastore <-> kafka transfer
Can be found here
npm install --save sinek
const {
JSConsumer,
JSProducer
} = require("sinek");
const jsProducerConfig = {
clientId: "my-app",
brokers: ["kafka1:9092"]
}
(async () => {
const topic = "my-topic";
const producer = new JSProducer(jsProducerConfig);
const consumer = new JSConsumer(topic, jsConsumerConfig);
producer.on("error", error => console.error(error));
consumer.on("error", error => console.error(error));
await consumer.connect();
// consume from a topic.
consumer.consume(async (messages) => {
messages.forEach((message) => {
console.log(message);
})
});
// Produce messages to a topic.
await producer.connect();
producer.send(topic, "a message")
})().catch(console.error);
- Best-practice example
- SSL example
- SASL+SSL example
- Alpine based docker example
- Debian based docker example
make it about them, not about you
- Simon Sinek