Giter Club home page Giter Club logo

kafkajs's Introduction

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.

kafkajs's People

Contributors

tulios avatar nevon avatar ianwsperber avatar jaaprood avatar klippx avatar dependabot[bot] avatar paambaati avatar kjdelisle avatar patrykwegrzyn avatar ankon avatar capucho avatar wmtst8 avatar mkaufmaner avatar terebentina avatar weily-yingmi avatar mahulst avatar colinfindlay-nz avatar blackdynamo avatar sklose avatar eliw00d avatar lcfumes avatar dieken avatar jacktuck avatar itayadler avatar posquit0 avatar abramjstamper avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.