Skip to content
jacktuckPublic
forked from tulios/kafkajs

About

A modern Apache Kafka client for node.js

Resources

Stars

1 star

Watchers

1 watching

Forks

 
 

Repository files navigation

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
  • Admin client

Getting Started

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

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

// Producing
const producer = kafka.producer()

await producer.connect()
await producer.send({
  topic: 'test-topic',
  messages: [
    { value: 'Hello KafkaJS user!' },
  ],
})

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

await consumer.connect()
await consumer.subscribe({ topic: 'test-topic' })

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

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.

Acknowledgements

Thanks to Sebastian Norde for the V1 logo ❤️

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

License

See LICENSE for more details.

About

A modern Apache Kafka client for node.js

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages