Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(product:CKafka): Node.js SDK SASL_PLAINTEX consumer.js demo 代码错误 #15868

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,7 @@ module.exports = {
1. 创建消费消息程序consumer.js。
<dx-codeblock>
::: js
consumer.on('event.log', function(event) {
console.log("event.log", event);
});

consumer.on('error', function(error) {
console.log("error:" + error);
});

consumer.on('event', function(event) {
console.log("event:" + event);
});const Kafka = require('node-rdkafka');
const Kafka = require('node-rdkafka');
const config = require('./setting');
console.log(Kafka.features);
console.log(Kafka.librdkafkaVersion);
Expand Down Expand Up @@ -216,29 +206,29 @@ module.exports = {
console.log(data);
});

consumer.on('event.log', function(event) {
console.log("event.log", event);
});

consumer.on('error', function(error) {
console.log("error:" + error);
});

consumer.on('event', function(event) {
console.log("event:" + event);
});

consumer.on('event.log', function(event) {
console.log("event.log", event);
});
:::
</dx-codeblock>


2. 执行以下命令消费消息。
3. 执行以下命令消费消息。

```bash
node consumer.js
```

3. 查看运行结果。
4. 查看运行结果。
![](https://main.qcloudimg.com/raw/deecbf58c00e07531b4ea703c4046b46.png)

4. 在 [CKafka 控制台](https://console.cloud.tencent.com/ckafka)**Consumer Group**页面,选择对应的消费组名称,在主题名称输入 Topic 名称,单击**查询详情**,查看消费详情。
5. 在 [CKafka 控制台](https://console.cloud.tencent.com/ckafka)**Consumer Group**页面,选择对应的消费组名称,在主题名称输入 Topic 名称,单击**查询详情**,查看消费详情。
![](https://main.qcloudimg.com/raw/3020dcb5f8fd73e02949b20fef4f956f.png)