# sinek

> Node.js kafka client, consumer, producer polite out of the box

Latest version **10.0.0-alpha.0** (published 2020-09-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install sinek
pnpm add sinek
yarn add sinek
bun add sinek
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 10.0.0-alpha.0 |
| Published | 2020-09-30 |
| First published | 2017-03-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.11.3 |
| Dependencies | 8 |
| Unpacked size | 209.2 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 289 |
| Author | Christian Fröhlingsdorf |
| Maintainers | wtrocki, krystianity, rob3000 |
| Keywords | polite, kafka, client, sinek, simon, nice, easy, producer, consumer, backpressure, control, flow, queue, ssl, secure, sasl, kerberos, librdkafka, stream, batch |

## Links

- npm: https://www.npmjs.com/package/sinek
- Repository: https://github.com/nodefluent/node-sinek
- Homepage: https://github.com/nodefluent/node-sinek#readme
- Issues: https://github.com/nodefluent/node-sinek/issues
- npm.io page: https://npm.io/package/sinek

## Dependencies (8)

- [uuid](https://npm.io/package/uuid.md) ~7.0.3
- [async](https://npm.io/package/async.md) ~3.2.0
- [debug](https://npm.io/package/debug.md) ~4.1.1
- [kafkajs](https://npm.io/package/kafkajs.md) 1.12.0
- [bluebird](https://npm.io/package/bluebird.md) ~3.7.2
- [murmurhash](https://npm.io/package/murmurhash.md) ~1.0.0
- [lodash.merge](https://npm.io/package/lodash.merge.md) ~4.6.2
- [murmur2-partitioner](https://npm.io/package/murmur2-partitioner.md) ~1.0.0

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 10.0.0-alpha.0 (latest) — 2020-09-30
- 9.1.0 — 2020-04-19
- 9.0.0 — 2020-02-24
- 8.2.0 — 2020-02-23
- 8.1.0 — 2019-11-15
- 8.0.0 — 2019-11-14
- 7.30.1 — 2019-07-30
- 7.30.0 — 2019-07-04
- 7.29.3 — 2019-05-07
- 7.29.2 — 2019-04-01
- 7.29.1 — 2019-03-29
- 7.29.0 — 2019-03-29
- 6.27.3 — 2019-03-15
- 6.27.2 — 2019-03-12
- 6.27.1 — 2019-03-12
- … 83 more at https://npm.io/package/sinek/versions

## README

# High Level Node.js Kafka Client

[![Build Status](https://travis-ci.org/nodefluent/node-sinek.svg?branch=master)](https://travis-ci.org/nodefluent/node-sinek)
[![npm version](https://badge.fury.io/js/sinek.svg)](https://badge.fury.io/js/sinek)

The most advanced Kafka Client.

## Features

* 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 on `node-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

## You might also like

* check out :goberserk: [node-kafka-streams](https://github.com/nodefluent/kafka-streams) for a stream processing kafka api
* check out :fire: [node-kafka-connect](https://github.com/nodefluent/kafka-connect) for a easy datastore <-> kafka transfer

## Latest Changes

Can be found [here](CHANGELOG.md)

## Install

```shell
npm install --save sinek
```

## Usage

### Usage - JS Client (based on kafka.js)

```javascript
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);

```

# Further Docs

* [Best-practice example](examples/best-practice-example)
* [SSL example](examples/ssl-example/)
* [SASL+SSL example](examples/sasl-ssl-example/)
* [Alpine based docker example](kafka-setup/alpine.Dockerfile)
* [Debian based docker example](kafka-setup/debian.Dockerfile)

> make it about them, not about you
> - Simon Sinek

---
_Source: https://npm.io/package/sinek · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
