Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Confluent's Apache Kafka JavaScript client

License

MIT and 2 other licenses found

Licenses found

MIT
LICENSE.txt
Unknown
LICENSE.kafkajs
Unknown
LICENSE.node-rdkafka
NotificationsYou must be signed in to change notification settings

confluentinc/confluent-kafka-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

confluent-kafka-javascript is Confluent's JavaScript client forApache Kafka and theConfluent Platform. The goal is to provide an highly performant, reliable and easy to use JavaScript client that is based onnode-rdkafka yet also API compatible withKafkaJS to provide flexibility to users and streamline migrations from other clients.

Features:

  • High performance - confluent-kafka-javascript is a lightweight wrapper aroundlibrdkafka, a finely tuned Cclient.

  • Reliability - There are a lot of details to get right when writing an Apache Kafkaclient. We get them right in one place (librdkafka) and leverage this workacross all of our clients.

  • Supported - Commercial support is offered byConfluent.

  • Future proof - Confluent, founded by thecreators of Kafka, is building astreaming platformwith Apache Kafka at its core. It's high priority for us that client features keeppace with core Apache Kafka and components of theConfluent Platform.

This library leverages the work and concepts from two popular Apache Kafka JavaScript clients:node-rdkafka andKafkaJS. The core is heavily based on the node-rdkafka library, which uses our ownlibrdkafka library for core client functionality. However, we leverage a promisified API and a more idiomatic interface, similar to the one in KafkaJS, making it easy for developers to migrate and adopt this client depending on the patterns and interface they prefer. We're very happy to have been able to leverage the excellent work of the many authors of these libraries!

To useSchema Registry, use the@confluentinc/schemaregistry library that is compatible with this library. For a simple schema registry example, seesr.js.

Requirements

The following configurations are supported:

  • Linux (x64 and arm64) - we support both musl and glibc based distributions:
DistributionSupported Node Versions
Debian Bullseye/Ubuntu 20.0418, 20, 21, 22, 23, 24
Debian Bookworm/Ubuntu 22.0418, 20, 21, 22, 23, 24
Alpine Linux 3.20+18, 20, 21, 22, 23, 24
AlmaLinux 9/Rocky Linux 9/CentOS Stream 918, 20, 21, 22, 23, 24

Other distributions will probably work given a modern version of gcc/glibc, but we don't test the pre-built binaries with them.

  • macOS - arm64/m1. macOS (Intel) is supported on a best-effort basis. Node versions 18, 20, 21, 22, 23 and 24 are supported.
  • Windows - x64. Node versions 18, 20, 21, 22, 23 and 24 are supported.

Warning

Pre-built binary support will be dropped after the EOL of the node version or the OS.

Installation on any of these platforms is meant to be seamless, without any C/C++ compilation required.

npm install @confluentinc/kafka-javascript

In case your system configuration is not within the supported ones, check the detailedinstallation instructions for more information.

Yarn and pnpm support is experimental.

Getting Started

Below is a simple produce example using the promisified API.

const{ Kafka}=require('@confluentinc/kafka-javascript').KafkaJS;asyncfunctionproducerStart(){constproducer=newKafka().producer({'bootstrap.servers':'<fill>','security.protocol':'SASL_SSL','sasl.mechanisms':'PLAIN','sasl.username':'<fill>','sasl.password':'<fill>',});awaitproducer.connect();console.log("Connected successfully");constres=[]for(leti=0;i<50;i++){res.push(producer.send({topic:'test-topic',messages:[{value:'v',partition:0,key:'x'},]}));}awaitPromise.all(res);awaitproducer.disconnect();console.log("Disconnected successfully");}producerStart();

There are two variants of the API offered by this library. A promisified API and a callback-based API.

  1. If you're starting afresh, you should use thepromisified API.
  2. If you're migrating fromkafkajs, you can use themigration guide to get started quickly.
  3. If you're migrating fromnode-rdkafka, you can use themigration guide.

An in-depth reference may be found atINTRODUCTION.md.

Contributing

Bug reports and feedback is appreciated in the form of Github Issues.For guidelines on contributing please seeCONTRIBUTING.md

Librdkafka Version

confluent-kafka-javascriptlibrdkafka
1.0.02.6.1
1.2.02.8.0
1.3.02.10.0
1.3.12.10.0
1.3.22.10.1
1.4.02.11.0
1.4.12.11.1
1.5.02.11.1
1.6.02.12.0
1.7.02.12.1

This mapping is applicable if you're using a pre-built binary. Otherwise, you can check the librdkafka version with the following command:

node -e'console.log(require("@confluentinc/kafka-javascript").librdkafkaVersion)'

[8]ページ先頭

©2009-2025 Movatter.jp