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
$ 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://*",
authentication: new Pulsar.AuthenticationToken({
token: "eyJh**",
}),
});
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.