Skip to content

Commit 6f2475b

Browse files
committed
Update README.md
1 parent d343682 commit 6f2475b

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

README.md

+30-29
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Confluent's JavaScript Client for Apache Kafka<sup>TM</sup>
22
=====================================================
33

44
**confluent-kafka-javascript** is Confluent's JavaScript client for [Apache Kafka](http://kafka.apache.org/) and the
5-
[Confluent Platform](https://www.confluent.io/product/compare/). This is an **limited availability** library. The goal is to provide an highly performant, reliable and easy to use JavaScript client that is based on [node-rdkafka](https://github.com/Blizzard/node-rdkafka) yet also API compatible with [KafkaJS](https://github.com/tulios/kafkajs) to provide flexibility to users and streamline migrations from other clients.
5+
[Confluent Platform](https://www.confluent.io/product/compare/). The goal is to provide an highly performant, reliable and easy to use JavaScript client that is based on [node-rdkafka](https://github.com/Blizzard/node-rdkafka) yet also API compatible with [KafkaJS](https://github.com/tulios/kafkajs) to provide flexibility to users and streamline migrations from other clients.
66

77
Features:
88

@@ -23,10 +23,7 @@ pace with core Apache Kafka and components of the [Confluent Platform](https://w
2323

2424
This library leverages the work and concepts from two popular Apache Kafka JavaScript clients: [node-rdkafka](https://github.com/Blizzard/node-rdkafka) and [KafkaJS](https://github.com/tulios/kafkajs). The core is heavily based on the node-rdkafka library, which uses our own [librdkafka](https://github.com/confluentinc/librdkafka) 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!
2525

26-
### This library is currently in limited-availability
27-
28-
To use **Schema Registry**, use the existing [@confluentinc/schemaregistry](https://www.npmjs.com/package/@confluentinc/schemaregistry) library that is compatible with this library. For a simple schema registry example, see [sr.js](https://github.com/confluentinc/confluent-kafka-javascript/blob/dev_early_access_development_branch/examples/kafkajs/sr.js).
29-
26+
To use **Schema Registry**, use the [@confluentinc/schemaregistry](https://www.npmjs.com/package/@confluentinc/schemaregistry) library that is compatible with this library. For a simple schema registry example, see [sr.js](https://github.com/confluentinc/confluent-kafka-javascript/blob/master/examples/kafkajs/sr.js).
3027

3128
## Requirements
3229

@@ -39,68 +36,72 @@ The following configurations are supported:
3936

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

42-
In case your system configuration is not within the supported ones, [a supported version of Python](https://devguide.python.org/versions/) must be available on the system for the installation process. [This is required for the `node-gyp` build tool.](https://github.com/nodejs/node-gyp?tab=readme-ov-file#configuring-python-dependency).
43-
4439
```bash
4540
npm install @confluentinc/kafka-javascript
4641
```
4742

43+
In case your system configuration is not within the supported ones, check the detailed [installation instructions](./INTRODUCTION.md#Installation-Instructions) for more information.
44+
4845
Yarn and pnpm support is experimental.
4946

5047
# Getting Started
5148

52-
Below is a simple produce example for users migrating from KafkaJS.
49+
Below is a simple produce example using the promisified API.
5350

5451
```javascript
55-
// require('kafkajs') is replaced with require('@confluentinc/kafka-javascript').KafkaJS.
56-
const { Kafka } = require("@confluentinc/kafka-javascript").KafkaJS;
52+
const { Kafka } = require('@confluentinc/kafka-javascript').KafkaJS;
5753

5854
async function producerStart() {
59-
const kafka = new Kafka({
60-
kafkaJS: {
61-
brokers: ['<fill>'],
62-
ssl: true,
63-
sasl: {
64-
mechanism: 'plain',
65-
username: '<fill>',
66-
password: '<fill>',
67-
},
68-
}
55+
const producer = new Kafka().producer({
56+
'bootstrap.servers': '<fill>',
57+
'security.protocol': 'SASL_SSL',
58+
'sasl.mechanisms': 'PLAIN',
59+
'sasl.username': '<fill>',
60+
'sasl.password': '<fill>',
6961
});
7062

71-
const producer = kafka.producer();
72-
7363
await producer.connect();
74-
7564
console.log("Connected successfully");
7665

7766
const res = []
7867
for (let i = 0; i < 50; i++) {
7968
res.push(producer.send({
8069
topic: 'test-topic',
8170
messages: [
82-
{ value: 'v222', partition: 0 },
83-
{ value: 'v11', partition: 0, key: 'x' },
71+
{ value: 'v', partition: 0, key: 'x' },
8472
]
8573
}));
8674
}
8775
await Promise.all(res);
8876

8977
await producer.disconnect();
90-
9178
console.log("Disconnected successfully");
9279
}
9380

9481
producerStart();
9582
```
9683

97-
1. If you're migrating from `kafkajs`, you can use the [migration guide](MIGRATION.md#kafkajs).
98-
2. If you're migrating from `node-rdkafka`, you can use the [migration guide](MIGRATION.md#node-rdkafka).
99-
3. If you're starting afresh, you can use the [quickstart guide](QUICKSTART.md).
84+
There are two variants of the API offered by this library. A promisified API and a callback-based API.
85+
86+
1. If you're starting afresh, you should use the [promisified API](INTRODUCTION.md#promisified-api).
87+
2. If you're migrating from `kafkajs`, you can use the [migration guide](MIGRATION.md#kafkajs) to get started quickly.
88+
3. If you're migrating from `node-rdkafka`, you can use the [migration guide](MIGRATION.md#node-rdkafka).
10089

10190
An in-depth reference may be found at [INTRODUCTION.md](INTRODUCTION.md).
10291

10392
## Contributing
10493

10594
Bug reports and feedback is appreciated in the form of Github Issues.
10695
For guidelines on contributing please see [CONTRIBUTING.md](CONTRIBUTING.md)
96+
97+
## Librdkafka Version
98+
99+
| confluent-kafka-javascript | librdkafka |
100+
| -------------------------- | ---------- |
101+
| 1.0.0 | 2.6.1 |
102+
103+
This mapping is applicable if you're using a pre-built binary. Otherwise, you can check the librdkafka version with the following command:
104+
105+
```bash
106+
node -e 'console.log(require("@confluentinc/kafka-javascript").librdkafkaVersion)'
107+
```

0 commit comments

Comments
 (0)