tencent cloud

Node.js SDK

PDF
Focus Mode
Font Size
Last updated: 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.


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback