tencent cloud

Node.js SDK

Download
포커스 모드
폰트 크기
마지막 업데이트 시간: 2025-12-24 15:07:56

Scenarios

TDMQ for Apache Pulsar clusters of version 2.7.1 and later already support the Node.js SDK of Apache Pulsar. This document describes how to access the SDK.

Prerequisites

You have obtained the client connection parameters as instructed in SDK Overview.

Operation Steps

1. Install the Node.js client in the environment where your client resides, as instructed in the Pulsar Official Documentation.
$ npm install pulsar-client
2. In the code for creating the Node.js client, configure the prepared access address and token.
const Pulsar = require("pulsar-client");

(async () => {
const client = new Pulsar.Client({
serviceUrl: "http://*", // Replace with the access address. You can copy the complete address from the Cluster page in the console.
authentication: new Pulsar.AuthenticationToken({
token: "eyJh**", // Change the example value to your actual token.
}),
});
await client.close();
})();
Note:
The Node.js SDK has different environmental dependencies across versions. It is recommended that you determine the Pulsar engine version and then view the usage practices according to the specific documentation.
For information about how to use the various features of the Node.js SDK of Apache Pulsar, see the Pulsar Official Documentation.


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백