Need help with kafkajs?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

tulios
1.8K Stars 236 Forks MIT License 2.5K Commits 127 Opened issues

Description

A modern Apache Kafka client for node.js

Services available

!
?

Need anything else?

Contributors list

# 13,152
kafka
HTML
CSS
jsonp
901 commits
# 66,353
HTML
SQL
kafka-c...
kafka
335 commits
# 55,594
kafka-c...
kafka
TypeScr...
CSS
111 commits
# 31,351
kafka
librdka...
Express
cpluspl...
78 commits
# 39,872
kafka
librdka...
TypeScr...
openapi
52 commits
# 180,920
ws
node
kafka
Rust
27 commits
# 40,402
TypeScr...
CSS
sqlserv...
Electro...
22 commits
# 257,118
kafka
TypeScr...
CSS
Shell
16 commits
# 86,557
codegen...
HTML
Electro...
Koa
14 commits
# 173,054
Shell
kafka
TypeScr...
CSS
13 commits
# 272,120
kafka
Apache ...
Go
HTML
9 commits
# 233,663
PHP
kafka
kerbero...
sasl
9 commits
# 139,511
Ruby
kafka
rubygem
TypeScr...
8 commits
# 344,380
kafka-c...
kafka
npm-pac...
TypeScr...
8 commits
# 371,690
kafka-c...
kafka
npm-pac...
TypeScr...
6 commits
# 355,033
algebra...
Shell
fantasy...
kafka
6 commits
# 120,349
chrome-...
GitHub
github-...
React N...
5 commits
# 1,052
meteor
MongoDB
reactiv...
npm
5 commits
# 259,729
CSS
kafka
TypeScr...
Shell
4 commits
# 213,398
CSS
HTML
swagger
loopbac...
4 commits

npm version npm pre-release version Build Status Slack Channel

Logo

KafkaJS

A modern Apache Kafka® client for Node.js
Get Started »

Read the Docs · Report Bug · Request Feature

Table of Contents

About the Project

KafkaJS is a modern Apache Kafka client for Node.js. It is compatible with Kafka 0.10+ and offers native support for 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

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

Getting Started

npm install kafkajs
# yarn add kafkajs

Usage

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)

Learn more about using KafkaJS on the official site!

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.

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 bug fixes, 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:

Contact 💬

Join our Slack community

Sponsors ❤️

To become a sponsor, reach out in our Slack community to get in touch with one of the maintainers. Also consider becoming a Github Sponsor by following any of the links under "Sponsor this project" in the sidebar.

License

See LICENSE for more details.

Acknowledgements

Apache Kafka and Kafka are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries. KafkaJS has no affiliation with the Apache Software Foundation.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.