kafkajs
A modern Apache Kafka client for node.js
Last updated 5 months ago by tulios .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install kafkajs 
SYNC missed versions from official npm registry.

KafkaJS

A modern Apache Kafka client for node.js. This library is compatible with Kafka 0.10+.
Native support for Kafka 0.11 features.

KafkaJS is battle-tested and ready for production.

Build Status npm version Slack Channel

Features

  • Producer
  • Consumer groups with pause, resume, and seek
  • Transactional support for producers and consumers
  • Message headers
  • GZIP compression
  • Snappy and LZ4 compression through plugins
  • Plain, SSL and SASL_SSL implementations
  • Support for SCRAM-SHA-256 and SCRAM-SHA-512
  • Support for AWS IAM authentication
  • Admin client

Read something on the website that didn't work with the latest stable version?
Check the pre-release versions - the website is updated on every merge to master.

Getting Started

npm install kafkajs
# yarn add kafkajs
const { Kafka } = require('kafkajs')

const kafka = new Kafka({
  clientId: 'my-app',
  brokers: ['kafka1:9092', 'kafka2:9092']
})

const producer = kafka.producer()
const consumer = kafka.consumer({ groupId: 'test-group' })

const run = async () => {
  // Producing
  await producer.connect()
  await producer.send({
    topic: 'test-topic',
    messages: [
      { value: 'Hello KafkaJS user!' },
    ],
  })

  // Consuming
  await consumer.connect()
  await consumer.subscribe({ topic: 'test-topic', fromBeginning: true })

  await consumer.run({
    eachMessage: async ({ topic, partition, message }) => {
      console.log({
        partition,
        offset: message.offset,
        value: message.value.toString(),
      })
    },
  })
}

run().catch(console.error)

Documentation

Learn more about using KafkaJS on the official site!

Contributing

KafkaJS is an open-source project where development takes place in the open on GitHub. Although the project is maintained by a small group of dedicated volunteers, we are grateful to the community for bugfixes, feature development and other contributions.

See Developing KafkaJS for information on how to run and develop KafkaJS.

Help wanted ????

We welcome contributions to KafkaJS, but we also want to see a thriving third-party ecosystem. If you would like to create an open-source project that builds on top of KafkaJS, please get in touch and we'd be happy to provide feedback and support.

Here are some projects that we would like to build, but haven't yet been able to prioritize:

Acknowledgements

Thanks to Sebastian Norde for the V1 logo ❤️

Thanks to Tracy (Tan Yun) for the V2 logo ❤️

Sponsored by:

License

See LICENSE for more details.

Current Tags

  • 1.13.0-beta.49                                ...           beta (7 days ago)
  • 1.12.0                                ...           latest (5 months ago)

144 Versions

  • 1.13.0-beta.49                                ...           7 days ago
  • 1.13.0-beta.48                                ...           14 days ago
  • 1.13.0-beta.47                                ...           16 days ago
  • 1.13.0-beta.46                                ...           16 days ago
  • 1.13.0-beta.45                                ...           16 days ago
  • 1.13.0-beta.44                                ...           16 days ago
  • 1.13.0-beta.43                                ...           16 days ago
  • 1.13.0-beta.42                                ...           16 days ago
  • 1.13.0-beta.41                                ...           17 days ago
  • 1.13.0-beta.40                                ...           18 days ago
  • 1.13.0-beta.39                                ...           18 days ago
  • 1.13.0-beta.38                                ...           19 days ago
  • 1.13.0-beta.37                                ...           19 days ago
  • 1.13.0-beta.36                                ...           20 days ago
  • 1.13.0-beta.35                                ...           a month ago
  • 1.13.0-beta.34                                ...           a month ago
  • 1.13.0-beta.33                                ...           a month ago
  • 1.13.0-beta.32                                ...           a month ago
  • 1.13.0-beta.31                                ...           a month ago
  • 1.13.0-beta.30                                ...           a month ago
  • 1.13.0-beta.29                                ...           a month ago
  • 1.13.0-beta.28                                ...           a month ago
  • 1.13.0-beta.27                                ...           a month ago
  • 1.13.0-beta.26                                ...           a month ago
  • 1.13.0-beta.25                                ...           a month ago
  • 1.13.0-beta.24                                ...           a month ago
  • 1.13.0-beta.23                                ...           a month ago
  • 1.13.0-beta.22                                ...           a month ago
  • 1.13.0-beta.21                                ...           2 months ago
  • 1.13.0-beta.20                                ...           2 months ago
  • 1.13.0-beta.19                                ...           2 months ago
  • 1.13.0-beta.18                                ...           2 months ago
  • 1.13.0-beta.17                                ...           2 months ago
  • 1.13.0-beta.16                                ...           3 months ago
  • 1.13.0-beta.15                                ...           3 months ago
  • 1.13.0-beta.14                                ...           4 months ago
  • 1.13.0-beta.13                                ...           4 months ago
  • 1.13.0-beta.12                                ...           4 months ago
  • 1.13.0-beta.11                                ...           4 months ago
  • 1.13.0-beta.10                                ...           4 months ago
  • 1.13.0-beta.9                                ...           4 months ago
  • 1.13.0-beta.8                                ...           4 months ago
  • 1.13.0-beta.7                                ...           4 months ago
  • 1.13.0-beta.6                                ...           4 months ago
  • 1.13.0-beta.5                                ...           4 months ago
  • 1.13.0-beta.4                                ...           4 months ago
  • 1.13.0-beta.3                                ...           4 months ago
  • 1.13.0-beta.2                                ...           5 months ago
  • 1.13.0-beta.1                                ...           5 months ago
  • 1.13.0-beta.0                                ...           5 months ago
  • 1.12.0                                ...           5 months ago
  • 1.12.0-beta.21                                ...           6 months ago
  • 1.12.0-beta.20                                ...           6 months ago
  • 1.12.0-beta.19                                ...           6 months ago
  • 1.12.0-beta.18                                ...           6 months ago
  • 1.12.0-beta.17                                ...           7 months ago
  • 1.12.0-beta.16                                ...           7 months ago
  • 1.12.0-beta.15                                ...           7 months ago
  • 1.12.0-beta.14                                ...           7 months ago
  • 1.12.0-beta.13                                ...           7 months ago
  • 1.12.0-beta.12                                ...           7 months ago
  • 1.12.0-beta.11                                ...           7 months ago
  • 1.12.0-beta.10                                ...           7 months ago
  • 1.12.0-beta.9                                ...           7 months ago
  • 1.12.0-beta.8                                ...           7 months ago
  • 1.12.0-beta.7                                ...           7 months ago
  • 1.12.0-beta.6                                ...           8 months ago
  • 1.12.0-beta.5                                ...           8 months ago
  • 1.12.0-beta.4                                ...           8 months ago
  • 1.12.0-beta.3                                ...           8 months ago
  • 1.12.0-beta.2                                ...           9 months ago
  • 1.12.0-beta.1                                ...           9 months ago
  • 1.12.0-beta.0                                ...           9 months ago
  • 1.11.0                                ...           9 months ago
  • 1.11.0-beta.13                                ...           10 months ago
  • 1.11.0-beta.12                                ...           10 months ago
  • 1.11.0-beta.11                                ...           10 months ago
  • 1.11.0-beta.10                                ...           a year ago
  • 1.11.0-beta.9                                ...           a year ago
  • 1.11.0-beta.8                                ...           a year ago
  • 1.11.0-beta.7                                ...           a year ago
  • 1.11.0-beta.6                                ...           a year ago
  • 1.11.0-beta.5                                ...           a year ago
  • 1.11.0-beta.4                                ...           a year ago
  • 1.11.0-beta.3                                ...           a year ago
  • 1.11.0-beta.2                                ...           a year ago
  • 1.11.0-beta.1                                ...           a year ago
  • 1.11.0-beta.0                                ...           a year ago
  • 1.10.0                                ...           a year ago
  • 1.10.0-beta.0                                ...           a year ago
  • 1.9.3                                ...           a year ago
  • 1.9.2                                ...           a year ago
  • 1.9.1                                ...           a year ago
  • 1.9.0                                ...           a year ago
  • 1.8.1                                ...           a year ago
  • 1.8.0                                ...           a year ago
  • 1.7.0                                ...           a year ago
  • 1.6.0                                ...           a year ago
  • 1.5.2                                ...           a year ago
  • 1.5.1                                ...           a year ago
  • 1.5.0                                ...           a year ago
  • 1.5.0-beta.4                                ...           a year ago
  • 1.5.0-beta.3                                ...           a year ago
  • 1.4.8                                ...           a year ago
  • 1.5.0-beta.2                                ...           a year ago
  • 1.5.0-beta.1                                ...           a year ago
  • 1.4.7                                ...           a year ago
  • 1.5.0-beta.0                                ...           2 years ago
  • 1.4.6                                ...           2 years ago
  • 1.4.5                                ...           2 years ago
  • 1.4.4                                ...           2 years ago
  • 1.4.3                                ...           2 years ago
  • 1.4.2 [deprecated]           ...           2 years ago
  • 1.4.1                                ...           2 years ago
  • 1.4.0                                ...           2 years ago
  • 1.3.1                                ...           2 years ago
  • 1.3.0                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.8.1                                ...           2 years ago
  • 0.8.0                                ...           2 years ago
  • 0.7.1                                ...           2 years ago
  • 0.7.0                                ...           2 years ago
  • 0.6.8                                ...           3 years ago
  • 0.6.7                                ...           3 years ago
  • 0.6.6                                ...           3 years ago
  • 0.6.5                                ...           3 years ago
  • 0.6.4                                ...           3 years ago
  • 0.6.3                                ...           3 years ago
  • 0.6.2                                ...           3 years ago
  • 0.6.1                                ...           3 years ago
  • 0.6.0                                ...           3 years ago
  • 0.5.0                                ...           3 years ago
  • 0.4.1                                ...           3 years ago
  • 0.4.0                                ...           3 years ago
  • 0.3.2                                ...           3 years ago
  • 0.3.1                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.2                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (2)
Downloads
Today 163
This Week 163
This Month 1,120
Last Day 13
Last Week 621
Last Month 2,374
Dependencies (1)
Dev Dependencies (23)
Dependents (92)

Copyright 2014 - 2016 © taobao.org |