GithubHelp home page GithubHelp logo

apache / pulsar-client-node Goto Github PK

View Code? Open in Web Editor NEW
145.0 39.0 83.0 1.58 MB

Apache Pulsar NodeJS Client

Home Page: https://pulsar.apache.org/

License: Apache License 2.0

JavaScript 33.19% Python 2.64% C++ 52.02% Shell 5.95% TypeScript 4.74% C 1.32% Batchfile 0.15%
pulsar pubsub messaging streaming queuing event-streaming node javascript nodejs

pulsar-client-node's Introduction

Pulsar Node.js client library

The Pulsar Node.js client can be used to create Pulsar producers and consumers in Node.js. For the supported Pulsar features, see Client Feature Matrix.

This library works only in Node.js 12.3 or later because it uses:

  1. The node-addon-api module to wrap the C++ library.
  2. The Mozilla CA file, which is provided by Node.js v12.3.0 and subsequent versions.

Getting Started

Note

These instructions are only available for versions after 1.8.0. For versions previous to 1.8.0, you need to install the C++ client first. Please switch to the corresponding version branch of this repo to read the specific instructions.

To run the examples, skip this section.

To use the Pulsar Node.js client in your project, run:

npm install pulsar-client

or

yarn add pulsar-client

Then you can run the following simple end-to-end example:

const Pulsar = require('pulsar-client');

(async () => {
  // Create a client
  const client = new Pulsar.Client({
    serviceUrl: 'pulsar://localhost:6650'
  });

  // Create a producer
  const producer = await client.createProducer({
    topic: 'persistent://public/default/my-topic',
  });

  // Create a consumer
  const consumer = await client.subscribe({
    topic: 'persistent://public/default/my-topic',
    subscription: 'sub1'
  });

  // Send a message
  producer.send({
    data: Buffer.from("hello")
  });

  // Receive the message
  const msg = await consumer.receive();
  console.log(msg.getData().toString());
  consumer.acknowledge(msg);

  await producer.close();
  await consumer.close();
  await client.close();
})();

You should find the output as:

hello

You can see more examples in the examples directory. However, since these examples might use an API that was not released yet, you need to build this module. See the next section.

How to build

Note

Building from source code requires a Node.js version greater than 16.18.

First, clone the repository.

git clone https://github.com/apache/pulsar-client-node.git
cd pulsar-client-node

Since this client is a C++ addon that depends on the Pulsar C++ client, you need to install the C++ client first. You need to ensure there is a C++ compiler that supports C++11 installed in your system.

  • Install C++ client on Linux:
pkg/linux/download-cpp-client.sh
  • Install C++ client on Windows:
pkg\windows\download-cpp-client.bat
  • Install C++ client on macOS:
pkg/mac/download-cpp-client.sh

After the C++ client is installed, run the following command to build this C++ addon.

npm install

To verify it has been installed successfully, you can run an example like:

Note

A running Pulsar server is required. The example uses pulsar://localhost:6650 to connect to the server.

node examples/producer

You should find the output as:

Sent message: my-message-0
Sent message: my-message-1
Sent message: my-message-2
Sent message: my-message-3
Sent message: my-message-4
Sent message: my-message-5
Sent message: my-message-6
Sent message: my-message-7
Sent message: my-message-8
Sent message: my-message-9

Documentation

For more details about Pulsar Node.js clients, see Pulsar docs.

Contribute

Contributions are welcomed and greatly appreciated.

If your contribution adds Pulsar features for Node.js clients, you need to update both the Pulsar docs and the Client Feature Matrix. See Contribution Guide for more details.

Generate API docs

npm install
npx typedoc
# Documentation generated at ./apidocs

pulsar-client-node's People

Contributors

bewaremypower avatar daghdha avatar dependabot[bot] avatar equanz avatar gaoran10 avatar gperinazzo avatar hrsakai avatar k2la avatar kontotto avatar magrain avatar matt-esch avatar merlimat avatar michaeljmarshall avatar mkaufmaner avatar momo-jun avatar nkurihar avatar rbarbey avatar rkaw92 avatar robertindie avatar romainbrancourt avatar romstar avatar roryschadler avatar savearray2 avatar shibd avatar shustsud avatar sijie avatar tisonkun avatar tuteng avatar xxxmrg avatar yosiat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pulsar-client-node's Issues

Support getRedeliveryCount of Message

I need to use message.getRedeliveryCount to acknowledge the message retryed too many(or to cancel the message). It seems not to be defined in pulsar-node-client but which is already defined in cpp client.

Is this going to be supported by pulsar-node-client? or are there any other ideas to achieve what I want?

Does pulsar-client-node support JWT authentication?

We want our service that uses node.js pulsar client to authenticate using JWT. I don't see here that Node.js client supports authentication using tokens based on JSON Web Tokens.

image

Is not this feature documented or implemented? If not implemented, we would like to request that feature.

Implement Asynchronous Processing Using C Async Function

Currently, asynchronous processing in this client library is implemented by using NAPI::AsyncWorker.
e.g. https://github.com/apache/pulsar-client-node/blob/master/src/Producer.cc#L89-L120

We used AsyncWorker because segmentation fault about NAPI objects occurred in callback registered with C async function.
FYI: nodejs/node-addon-api#457

The throughput of asynchronous processing using NAPI::AsyncWorker is lower than that using C async function(e.g. pulsar_client_create_producer_async).

Therefore, we want to use C async function in order to make performance better.

Producer connection status

It would be nice to know if the producer is actually connected. Something like isLive would be amazing.

Listening for messages

How can I listen to incoming messages? The listener property on consumer doesn't seem to do anything.

npm install fails on MacOS

System Information

  • Operating System: MacOS Catalina 10.15.2
  • Node version: 12.13.1
  • node-gyp version: 6.1.0
  • C++ Client: 2.5.0 (brew install libpulsar)

Running npm install pulsar-client results in the following error:

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.1.0-node-v72-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
  CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
  LIBTOOL-STATIC Release/nothing.a
  CXX(target) Release/obj.target/Pulsar/src/addon.o
In file included from ../src/addon.cc:20:
../src/Message.h:24:10: fatal error: 'pulsar/c/message.h' file not found
#include <pulsar/c/message.h>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/Pulsar/src/addon.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/richturnbull/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/Users/richturnbull/.nvm/versions/node/v12.13.1/bin/node" "/Users/richturnbull/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client/build/Release/libpulsar.node" "--module_name=libpulsar" "--module_path=/Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/richturnbull/.nvm/versions/node/v12.13.1/bin/node /Users/richturnbull/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client/build/Release/libpulsar.node --module_name=libpulsar --module_path=/Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/richturnbull/dev/es/pulsar/client/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Darwin 19.2.0
node-pre-gyp ERR! command "/Users/richturnbull/.nvm/versions/node/v12.13.1/bin/node" "/Users/richturnbull/dev/es/pulsar/client/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client
node-pre-gyp ERR! node -v v12.13.1
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/Users/richturnbull/.nvm/versions/node/v12.13.1/bin/node /Users/richturnbull/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client/build/Release/libpulsar.node --module_name=libpulsar --module_path=/Users/richturnbull/dev/es/pulsar/client/node_modules/pulsar-client/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/richturnbull/.npm/_logs/2020-04-17T11_38_18_780Z-debug.log

automating the install of pulsar-client and pulsar-client-dev

Another package I use (node-sass) downloads and builds its native dependencies automatically.
It does this by using npm's install and post install hooks: https://github.com/sass/node-sass/blob/887199a28fbed12f18dfecbfa5495aa5d48b2d4e/package.json#L31
their install script: https://github.com/sass/node-sass/blob/master/scripts/install.js
their postinstall script: https://github.com/sass/node-sass/blob/master/scripts/build.js

automating the install of pulsar-client and pulsar-client-dev would make it much easier to use this library.

Resolve eslint issues

/Users/a.ahmed/workspace/pulsar-client-node/examples/consumer.js
  38:17  warning  Unexpected `await` inside a loop  no-await-in-loop

/Users/a.ahmed/workspace/pulsar-client-node/perf/perf_consumer.js
  80:5   warning  Unexpected `await` inside a loop  no-await-in-loop
  91:26  warning  Unexpected `await` inside a loop  no-await-in-loop

/Users/a.ahmed/workspace/pulsar-client-node/perf/perf_producer.js
  86:5  warning  Unexpected `await` inside a loop  no-await-in-loop
  98:5  warning  Unexpected `await` inside a loop  no-await-in-loop

✖ 5 problems (0 errors, 5 warnings)

Creating a subscription with initial position as "earliest"

My use case: I have a shared subscription with a bunch of consumers. Suppose, all the consumers die and there are messages still being published to the topic. When a new consumer comes in, I want it to read from the last unacknowledged message so that no messages are lost or unprocessed.

So, I want to create a subscription with initial subscription position as earliest but I don't see any option to set the initial position. Also, What is default behavior? earliest or latest ?

Install pulsar-node on Windows NPM

System information

Run the command
npm install pulsar-client --save

The error message

Command: node-pre-gyp install --fallback-to-build
Arguments: 
Directory: F:\project\node\pulsar-node-demo\node_modules\pulsar-client
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | win32 | x64
node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp info check checked for "F:\project\node\pulsar-node-demo\node_modules\pulsar-client\build\Release\libpulsar.node" (not found)
node-pre-gyp http GET https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.1.0-node-v72-win32-x64.tar.gz
node-pre-gyp http 404 https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.1.0-node-v72-win32-x64.tar.gz
node-pre-gyp WARN Tried to download(404): https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.1.0-node-v72-win32-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp http 404 status code downloading tarball https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.1.0-node-v72-win32-x64.tar.gz 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Python27\python2.EXE

Support for Avro schema on `createProducer`

Would it be possible to add a schema property on the config object that initializes createProducer? Similar to what Python does, we could initialize avro-js with the JSON schema and call type.getSchema() to initialize the producer.

Having to disable schema validation on topics isn't ideal for some cases and I think only Java and Python are the clients that have schema support.

A pseudo code would look like:

    const client = new Pulsar.Client({
      serviceUrl: 'pulsar://localhost:6650',
    });

    const type = avro.parse({
      name: 'Pet',
      type: 'record',
      fields: [
        {name: 'kind', type: {name: 'Kind', type: 'enum', symbols: ['CAT', 'DOG']}},
        {name: 'name', type: 'string'}
      ]
    });

    const producer = await client.createProducer({
      topic: 'persistent://public/default/my-topic',
      schema: type.getSchema(),
    });

I'm not sure if the schema validation happens on the client when creating the producer, even if that is the case avro-js has methods to check whether JS objects are valid for a given schema.

On that same line, alternatively, is there any guidelines on how to implement a client? What makes it more difficult for me is that I don't know c++ and I would like to contribute with the JS library (specially Typescript).

Fail on disconnect

Is there/should there be a way to fail a subscription when disconnected from the server?

I would normally crash the process when this happens..

However

const msg = await consumer.receive();

just seems to wait forever with debug output indicating retrying but operationTimeoutCeconds having no effect.

Fail on send message and receive message

Hi,
I have a question, when I use more than three consumers and producers together, I can't send any message and got message. I have no idea to debug it.

'use strict';

let Pulsar = require('pulsar-client');

(async function main() {
  let client = new Pulsar.Client({
    serviceUrl: 'pulsar://localhost:6650',
  });

  let topics = [
    'non-persistent://public/default/foo1',
    'non-persistent://public/default/foo2',
    'non-persistent://public/default/foo3',
    'non-persistent://public/default/foo4',
  ];
  let producers = {};
  for (let topic of topics) {
    let producer = await client.createProducer({
      topic: topic,
    });
    producers[topic] = producer;
  }

  console.log('---producer-done');
  let consumers = {};
  for (let topic of topics) {
    let consumer = await client.subscribe({
      topic: topic,
      subscription: 'sub1',
      subscriptionType: 'Failover',
      receiverQueueSize: 100000,
      receiverQueueSizeAcrossPartitions: 100000,
    });
    consumers[topic] = consumer;
  }

  for (let topic in consumers) {
    (async function(topic) {
      while (true) {
        let now = Date.now();
        try {
          console.log('wait', topic);
          const consumer = consumers[topic];
          const msg = await consumer.receive(1000*60*30);
          let new_now = Date.now();
          console.log('get', topic, JSON.parse(msg.getData().toString()), new_now-now);
          now = new_now;
          consumer.acknowledge(msg);
        } catch(err) {
          console.log('timeout', topic);
        }
      }
    })(topic)
  }

  console.log('---completed');

  for (let topic in producers) {
    setInterval(async() => {
      const producer = producers[topic];
      console.log('send', topic);
      let now = Date.now();
      await producer.send({
        data: Buffer.from(JSON.stringify({now})),
      });
      console.log('send done', topic);
    }, 500);
  }
})();

Thousands of producers are getting created

Hi, I'm using node pulsar client to publish messages on a partitioned pulsar topic with 100 partitions. I'm spawning 20 node processes and reusing the same producer(I'm not closing the producer) that means there should be only 20 producers. But, when I see topic stats it shows a lot of producers (in thousands). What I'm doing wrong? Also, is there a difference b/w a producer and a publisher?

double free or corruption (out): 0x00007f85abffad00

Pulsar 2.4 runs in docker on the remote machine
The project has three readers like this.
Common client between them and 3 local readers.
Each of them reads own topic.

//common client
scope.client = new Pulsar.Client({
		serviceUrl: 'pulsar://xx.xx.xx.xx:6650',
		operationTimeoutSeconds: 30
});
//different files
const reader = await scope.client.createReader({
	topic: 'persistent://public/default/xxx',
	startMessageId: Pulsar.MessageId.earliest()
});
async.forever(async () => {
	let msg = await reader.readNext();
	const msgId = msg.getMessageId().serialize()
	const payload = JSON.parse(msg.getData().toString());
	// async work...
	return Promise.resolve()
})

Get this error 3 times when new messages come to topic. Don't know what exactly was the cause

*** Error in `node /usr/src/apps/ms-log/index.js': double free or corruption (out): 0x00007f85abffad00 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x70bfb)[0x7f85bc7e2bfb]
/lib/x86_64-linux-gnu/libc.so.6(+0x76fc6)[0x7f85bc7e8fc6]
/lib/x86_64-linux-gnu/libc.so.6(+0x7780e)[0x7f85bc7e980e]
/usr/src/apps/ms-log/node_modules/pulsar-client/build/Release/Pulsar.node(_ZN9MessageIdD1Ev+0x15)[0x7f85b851cbe5]
/usr/src/apps/ms-log/node_modules/pulsar-client/build/Release/Pulsar.node(_ZN4Napi10ObjectWrapI9MessageIdE16FinalizeCallbackEP10napi_env__PvS5_+0x19)[0x7f85b8520e09]
node /usr/src/apps/ms-log/index.js[0x8d79a6]
node /usr/src/apps/ms-log/index.js(_ZN2v88internal13GlobalHandles32InvokeSecondPassPhantomCallbacksEPNS0_4ListINS1_22PendingPhantomCallbackENS0_25FreeStoreAllocationPolicyEEEPNS0_7IsolateE+0xa8)[0xddd9e8]
node /usr/src/apps/ms-log/index.js(_ZN2v88internal13GlobalHandles37PendingPhantomCallbacksSecondPassTask11RunInternalEv+0x179)[0xdddb79]
node /usr/src/apps/ms-log/index.js(_ZN2v88internal14CancelableTask3RunEv+0x36)[0xb42e96]
node /usr/src/apps/ms-log/index.js(_ZN4node22PerIsolatePlatformData28FlushForegroundTasksInternalEv+0x2bb)[0x924bfb]
node /usr/src/apps/ms-log/index.js[0x9b989b]
node /usr/src/apps/ms-log/index.js[0x9ca5c0]
node /usr/src/apps/ms-log/index.js(uv_run+0x195)[0x9ba265]
node /usr/src/apps/ms-log/index.js(_ZN4node5StartEP9uv_loop_siPKPKciS5_+0x4b5)[0x8d6815]
node /usr/src/apps/ms-log/index.js(_ZN4node5StartEiPPc+0x160)[0x8d5b70]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f85bc7922e1]
node /usr/src/apps/ms-log/index.js[0x89f301]
======= Memory map: ========
00400000-01f6b000 r-xp 00000000 08:01 1693175                            /usr/local/bin/node
0216a000-02185000 rw-p 01b6a000 08:01 1693175                            /usr/local/bin/node
02185000-0219c000 rw-p 00000000 00:00 0
03004000-03312000 rw-p 00000000 00:00 0                                  [heap]
263a600000-263a680000 rw-p 00000000 00:00 0
e871080000-e871100000 rw-p 00000000 00:00 0
25695880000-25695900000 rw-p 00000000 00:00 0
26f05e00000-26f05e80000 rw-p 00000000 00:00 0
3a624480000-3a624500000 rw-p 00000000 00:00 0
3b091080000-3b091100000 rw-p 00000000 00:00 0
515b6400000-515b6480000 rw-p 00000000 00:00 0
5b53ae00000-5b53ae80000 rw-p 00000000 00:00 0
5db7b780000-5db7b800000 rw-p 00000000 00:00 0
65452800000-65452880000 rw-p 00000000 00:00 0
66918080000-66918100000 rw-p 00000000 00:00 0
7d1e5800000-7d1e5880000 rw-p 00000000 00:00 0
7e6bd700000-7e6bd780000 rw-p 00000000 00:00 0
89c64180000-89c64200000 rw-p 00000000 00:00 0
a7cda880000-a7cda900000 rw-p 00000000 00:00 0
aae85200000-aae85280000 rw-p 00000000 00:00 0
b519b100000-b519b180000 rw-p 00000000 00:00 0
b95c6a80000-b95c6b00000 rw-p 00000000 00:00 0
c2680e00000-c2680e80000 rw-p 00000000 00:00 0
ca13d400000-ca13d480000 rw-p 00000000 00:00 0
d0bb8880000-d0bb8900000 rw-p 00000000 00:00 0
e4be6480000-e4be6500000 rw-p 00000000 00:00 0
edb68800000-edb68880000 rw-p 00000000 00:00 0
1019fbf80000-1019fc000000 rw-p 00000000 00:00 0
114b43680000-114b43700000 rw-p 00000000 00:00 0
116caee00000-116caee80000 rw-p 00000000 00:00 0
1173a4c00000-1173a4c80000 rw-p 00000000 00:00 0
11d0b4480000-11d0b4500000 rw-p 00000000 00:00 0
12f4efa00000-12f4efa80000 rw-p 00000000 00:00 0
130a40a80000-130a40b00000 rw-p 00000000 00:00 0
1343e1f80000-1343e2000000 rw-p 00000000 00:00 0
135951000000-135951080000 rw-p 00000000 00:00 0
13d513c00000-13d513c80000 rw-p 00000000 00:00 0
140df0900000-140df0980000 rw-p 00000000 00:00 0
141ce3400000-141ce3405000 rw-p 00000000 00:00 0
150d259e2000-150d25a00000 ---p 00000000 00:00 0
150d25a00000-150d25a03000 rw-p 00000000 00:00 0
150d25a03000-150d25a04000 ---p 00000000 00:00 0
150d25a04000-150d25a2d000 rwxp 00000000 00:00 0
150d25a2d000-150d25a80000 ---p 00000000 00:00 0
150d25a80000-150d25a83000 rw-p 00000000 00:00 0
150d25a83000-150d25a84000 ---p 00000000 00:00 0
150d25a84000-150d25aad000 rwxp 00000000 00:00 0
150d25aad000-150d25b00000 ---p 00000000 00:00 0
150d25b00000-150d25b03000 rw-p 00000000 00:00 0
150d25b03000-150d25b04000 ---p 00000000 00:00 0
150d25b04000-150d25b2d000 rwxp 00000000 00:00 0
150d25b2d000-150d25b80000 ---p 00000000 00:00 0
150d25b80000-150d25b83000 rw-p 00000000 00:00 0
150d25b83000-150d25b84000 ---p 00000000 00:00 0
150d25b84000-150d25bff000 rwxp 00000000 00:00 0
150d25bff000-150d25c00000 ---p 00000000 00:00 0
150d25c00000-150d25c03000 rw-p 00000000 00:00 0
150d25c03000-150d25c04000 ---p 00000000 00:00 0
150d25c04000-150d25c7f000 rwxp 00000000 00:00 0
150d25c7f000-150d25c80000 ---p 00000000 00:00 0
150d25c80000-150d25c83000 rw-p 00000000 00:00 0
150d25c83000-150d25c84000 ---p 00000000 00:00 0
150d25c84000-150d25cff000 rwxp 00000000 00:00 0
150d25cff000-150d25d00000 ---p 00000000 00:00 0
150d25d00000-150d25d03000 rw-p 00000000 00:00 0
150d25d03000-150d25d04000 ---p 00000000 00:00 0
150d25d04000-150d25d7f000 rwxp 00000000 00:00 0
150d25d7f000-150d459e2000 ---p 00000000 00:00 0
153b91200000-153b91280000 rw-p 00000000 00:00 0
154b3cf00000-154b3cf80000 rw-p 00000000 00:00 0
1558ea780000-1558ea800000 rw-p 00000000 00:00 0
174b88600000-174b88680000 rw-p 00000000 00:00 0
175b66d80000-175b66e00000 rw-p 00000000 00:00 0
186f3d600000-186f3d680000 rw-p 00000000 00:00 0
18c8bbe80000-18c8bbf00000 rw-p 00000000 00:00 0
18dec5d80000-18dec5e00000 rw-p 00000000 00:00 0
190be5400000-190be5480000 rw-p 00000000 00:00 0
1917a1600000-1917a1680000 rw-p 00000000 00:00 0
19a981c00000-19a981c80000 rw-p 00000000 00:00 0
1b1179f00000-1b1179f80000 rw-p 00000000 00:00 0
1b944bb80000-1b944bc00000 rw-p 00000000 00:00 0
1bebbae00000-1bebbae80000 rw-p 00000000 00:00 0
1c6e99c00000-1c6e99c80000 rw-p 00000000 00:00 0
1cdf76400000-1cdf76480000 rw-p 00000000 00:00 0
1d5ff0680000-1d5ff0700000 rw-p 00000000 00:00 0
1deb48900000-1deb48980000 rw-p 00000000 00:00 0
1e2a16700000-1e2a16780000 rw-p 00000000 00:00 0
1e3edf300000-1e3edf380000 rw-p 00000000 00:00 0
1f68ff080000-1f68ff100000 rw-p 00000000 00:00 0
1fd99f080000-1fd99f100000 rw-p 00000000 00:00 0
1feef4880000-1feef4900000 rw-p 00000000 00:00 0
203fc0600000-203fc0680000 rw-p 00000000 00:00 0
205b24380000-205b24400000 rw-p 00000000 00:00 0
20859ed80000-20859ee00000 rw-p 00000000 00:00 0
20d7f8e80000-20d7f8f00000 rw-p 00000000 00:00 0
20fafdb80000-20fafdc00000 rw-p 00000000 00:00 0
2116a9180000-2116a9200000 rw-p 00000000 00:00 0
215c22880000-215c22900000 rw-p 00000000 00:00 0
21efb0f00000-21efb0f80000 rw-p 00000000 00:00 0
220f5d880000-220f5d900000 rw-p 00000000 00:00 0
2352cea80000-2352ceb00000 rw-p 00000000 00:00 0
25061d500000-25061d580000 rw-p 00000000 00:00 0
250e0ae00000-250e0ae80000 rw-p 00000000 00:00 0
25683be80000-25683bf00000 rw-p 00000000 00:00 0
25a60c880000-25a60c900000 rw-p 00000000 00:00 0
274569200000-274569280000 rw-p 00000000 00:00 0
278de7e80000-278de7f00000 rw-p 00000000 00:00 0
27c7dba80000-27c7dbb00000 rw-p 00000000 00:00 0
27f79f100000-27f79f180000 rw-p 00000000 00:00 0
27f9d8c80000-27f9d8d00000 rw-p 00000000 00:00 0
28c859100000-28c859180000 rw-p 00000000 00:00 0
29fa6a400000-29fa6a480000 rw-p 00000000 00:00 0
2a06aec80000-2a06aed00000 rw-p 00000000 00:00 0
2af16f800000-2af16f880000 rw-p 00000000 00:00 0
2b4a84300000-2b4a84380000 rw-p 00000000 00:00 0
2b839b180000-2b839b200000 rw-p 00000000 00:00 0
2b86d0f80000-2b86d1000000 rw-p 00000000 00:00 0
2d3841b00000-2d3841b80000 rw-p 00000000 00:00 0
2ea9ad700000-2ea9ad780000 rw-p 00000000 00:00 0
2ef98d000000-2ef98d080000 rw-p 00000000 00:00 0
2f2ba8180000-2f2ba8200000 rw-p 00000000 00:00 0
2f53f8e00000-2f53f8e80000 rw-p 00000000 00:00 0
2f5b60a80000-2f5b60b00000 rw-p 00000000 00:00 0
30a34f100000-30a34f180000 rw-p 00000000 00:00 0
310e82880000-310e82900000 rw-p 00000000 00:00 0
32e85a880000-32e85a900000 rw-p 00000000 00:00 0
330939700000-330939780000 rw-p 00000000 00:00 0
331750a80000-331750b00000 rw-p 00000000 00:00 0
33eb4e800000-33eb4e883000 rw-p 00000000 00:00 0
340506e80000-340506f00000 rw-p 00000000 00:00 0
34351fa80000-34351fb00000 rw-p 00000000 00:00 0
343fdd680000-343fdd6cf000 rw-p 00000000 00:00 0
34aef6480000-34aef6500000 rw-p 00000000 00:00 0
351d06d80000-351d06e00000 rw-p 00000000 00:00 0
3567d5c00000-3567d5c80000 rw-p 00000000 00:00 0
356d33e00000-356d33e80000 rw-p 00000000 00:00 0
35c03d600000-35c03d680000 rw-p 00000000 00:00 0
36994f300000-36994f380000 rw-p 00000000 00:00 0
36b588b80000-36b588c00000 rw-p 00000000 00:00 0
3729e3900000-3729e3980000 rw-p 00000000 00:00 0
382536780000-382536800000 rw-p 00000000 00:00 0
38a3b6f80000-38a3b7000000 rw-p 00000000 00:00 0
397e45900000-397e45980000 rw-p 00000000 00:00 0
399e85480000-399e85500000 rw-p 00000000 00:00 0
3b1ee8100000-3b1ee8180000 rw-p 00000000 00:00 0
3b6705e80000-3b6705f00000 rw-p 00000000 00:00 0
3bf455d80000-3bf455e00000 rw-p 00000000 00:00 0
3bf457080000-3bf457100000 rw-p 00000000 00:00 0
3c315e900000-3c315e980000 rw-p 00000000 00:00 0
3cc58bb00000-3cc58bb80000 rw-p 00000000 00:00 0
3d0f35500000-3d0f35580000 rw-p 00000000 00:00 0
3dd344080000-3dd344100000 rw-p 00000000 00:00 0
3de824400000-3de824480000 rw-p 00000000 00:00 0
3e4483e80000-3e4483f00000 rw-p 00000000 00:00 0
3f225ede5000-3f225ede8000 ---p 00000000 00:00 0
3f225ede8000-3f225edf0000 rw-p 00000000 00:00 0
3f225edf0000-3f225edf1000 ---p 00000000 00:00 0
3f4bf5700000-3f4bf5780000 rw-p 00000000 00:00 0
7f857c000000-7f857c021000 rw-p 00000000 00:00 0
7f857c021000-7f8580000000 ---p 00000000 00:00 0
7f8584000000-7f8584021000 rw-p 00000000 00:00 0
7f8584021000-7f8588000000 ---p 00000000 00:00 0
7f8588000000-7f8588021000 rw-p 00000000 00:00 0
7f8588021000-7f858c000000 ---p 00000000 00:00 0
7f858c000000-7f858c036000 rw-p 00000000 00:00 0
7f858c036000-7f8590000000 ---p 00000000 00:00 0
7f8590000000-7f8590021000 rw-p 00000000 00:00 0
7f8590021000-7f8594000000 ---p 00000000 00:00 0
7f8594000000-7f8594021000 rw-p 00000000 00:00 0
7f8594021000-7f8598000000 ---p 00000000 00:00 0
7f8598000000-7f8598021000 rw-p 00000000 00:00 0
7f8598021000-7f859c000000 ---p 00000000 00:00 0
7f85a0000000-7f85a0029000 rw-p 00000000 00:00 0
7f85a0029000-7f85a4000000 ---p 00000000 00:00 0
7f85a4000000-7f85a4141000 rw-p 00000000 00:00 0
7f85a4141000-7f85a8000000 ---p 00000000 00:00 0
7f85a9d03000-7f85a9d17000 r-xp 00000000 08:01 1828637                    /lib/x86_64-linux-gnu/libresolv-2.24.so
7f85a9d17000-7f85a9f16000 ---p 00014000 08:01 1828637                    /lib/x86_64-linux-gnu/libresolv-2.24.so
7f85a9f16000-7f85a9f17000 r--p 00013000 08:01 1828637                    /lib/x86_64-linux-gnu/libresolv-2.24.so
7f85a9f17000-7f85a9f18000 rw-p 00014000 08:01 1828637                    /lib/x86_64-linux-gnu/libresolv-2.24.so
7f85a9f18000-7f85a9f1a000 rw-p 00000000 00:00 0
7f85a9f1a000-7f85a9f1b000 ---p 00000000 00:00 0
7f85a9f1b000-7f85aa71b000 rwxp 00000000 00:00 0
7f85aa71b000-7f85aa71c000 ---p 00000000 00:00 0
7f85aa71c000-7f85aaf1c000 rwxp 00000000 00:00 0
7f85aaf1c000-7f85aaf1d000 ---p 00000000 00:00 0
7f85aaf1d000-7f85ab71d000 rwxp 00000000 00:00 0
7f85ab71d000-7f85abdb2000 r-xp 00000000 08:01 1434296                    /usr/lib/libpulsar.so.2.4.0
7f85abdb2000-7f85abfb2000 ---p 00695000 08:01 1434296                    /usr/lib/libpulsar.so.2.4.0
7f85abfb2000-7f85abfe0000 r--p 00695000 08:01 1434296                    /usr/lib/libpulsar.so.2.4.0
7f85abfe0000-7f85abff8000 rw-p 006c3000 08:01 1434296                    /usr/lib/libpulsar.so.2.4.0
7f85abff8000-7f85ac000000 rw-p 00000000 00:00 0
7f85ac000000-7f85ac098000 rw-p 00000000 00:00 0
7f85ac098000-7f85b0000000 ---p 00000000 00:00 0
7f85b0000000-7f85b00fe000 rw-p 00000000 00:00 0
7f85b00fe000-7f85b4000000 ---p 00000000 00:00 0
7f85b4000000-7f85b4055000 rw-p 00000000 00:00 0
7f85b4055000-7f85b8000000 ---p 00000000 00:00 0
7f85b80df000-7f85b80e4000 r-xp 00000000 08:01 1828616                    /lib/x86_64-linux-gnu/libnss_dns-2.24.so
7f85b80e4000-7f85b82e3000 ---p 00005000 08:01 1828616                    /lib/x86_64-linux-gnu/libnss_dns-2.24.so
7f85b82e3000-7f85b82e4000 r--p 00004000 08:01 1828616                    /lib/x86_64-linux-gnu/libnss_dns-2.24.so
7f85b82e4000-7f85b82e5000 rw-p 00005000 08:01 1828616                    /lib/x86_64-linux-gnu/libnss_dns-2.24.so
7f85b82e5000-7f85b82ef000 r-xp 00000000 08:01 1828618                    /lib/x86_64-linux-gnu/libnss_files-2.24.so
7f85b82ef000-7f85b84ef000 ---p 0000a000 08:01 1828618                    /lib/x86_64-linux-gnu/libnss_files-2.24.so
7f85b84ef000-7f85b84f0000 r--p 0000a000 08:01 1828618                    /lib/x86_64-linux-gnu/libnss_files-2.24.so
7f85b84f0000-7f85b84f1000 rw-p 0000b000 08:01 1828618                    /lib/x86_64-linux-gnu/libnss_files-2.24.so
7f85b84f1000-7f85b84f7000 rw-p 00000000 00:00 0
7f85b84f7000-7f85b8568000 r-xp 00000000 08:01 1567106                    /usr/src/apps/ms-log/node_modules/pulsar-client/build/Release/Pulsar.node
7f85b8568000-7f85b8767000 ---p 00071000 08:01 1567106                    /usr/src/apps/ms-log/node_modules/pulsar-client/build/Release/Pulsar.node
7f85b8767000-7f85b8768000 r--p 00070000 08:01 1567106                    /usr/src/apps/ms-log/node_modules/pulsar-client/build/Release/Pulsar.node
7f85b8768000-7f85b8769000 rw-p 00071000 08:01 1567106                    /usr/src/apps/ms-log/node_modules/pulsar-client/build/Release/Pulsar.node
7f85b8769000-7f85b876a000 rw-p 00000000 00:00 0
7f85b876a000-7f85b876b000 ---p 00000000 00:00 0
7f85b876b000-7f85b8f6b000 rwxp 00000000 00:00 0
7f85b8f6b000-7f85b8f6c000 ---p 00000000 00:00 0
7f85b8f6c000-7f85b976c000 rwxp 00000000 00:00 0
7f85b976c000-7f85b976d000 ---p 00000000 00:00 0
7f85b976d000-7f85b9f6d000 rwxp 00000000 00:00 0
7f85b9f6d000-7f85b9f6e000 ---p 00000000 00:00 0
7f85b9f6e000-7f85ba76e000 rwxp 00000000 00:00 0
7f85ba76e000-7f85ba76f000 ---p 00000000 00:00 0
7f85ba76f000-7f85baf6f000 rwxp 00000000 00:00 0
7f85baf6f000-7f85baf70000 ---p 00000000 00:00 0
7f85baf70000-7f85bb770000 rwxp 00000000 00:00 0
7f85bb770000-7f85bb771000 ---p 00000000 00:00 0
7f85bb771000-7f85bbf71000 rwxp 00000000 00:00 0
7f85bbf71000-7f85bbf72000 ---p 00000000 00:00 0
7f85bbf72000-7f85bc772000 rwxp 00000000 00:00 0
7f85bc772000-7f85bc907000 r-xp 00000000 08:01 1827396                    /lib/x86_64-linux-gnu/libc-2.24.so
7f85bc907000-7f85bcb07000 ---p 00195000 08:01 1827396                    /lib/x86_64-linux-gnu/libc-2.24.so
7f85bcb07000-7f85bcb0b000 r--p 00195000 08:01 1827396                    /lib/x86_64-linux-gnu/libc-2.24.so
7f85bcb0b000-7f85bcb0d000 rw-p 00199000 08:01 1827396                    /lib/x86_64-linux-gnu/libc-2.24.so
7f85bcb0d000-7f85bcb11000 rw-p 00000000 00:00 0
7f85bcb11000-7f85bcb29000 r-xp 00000000 08:01 1828635                    /lib/x86_64-linux-gnu/libpthread-2.24.so
7f85bcb29000-7f85bcd28000 ---p 00018000 08:01 1828635                    /lib/x86_64-linux-gnu/libpthread-2.24.so
7f85bcd28000-7f85bcd29000 r--p 00017000 08:01 1828635                    /lib/x86_64-linux-gnu/libpthread-2.24.so
7f85bcd29000-7f85bcd2a000 rw-p 00018000 08:01 1828635                    /lib/x86_64-linux-gnu/libpthread-2.24.so
7f85bcd2a000-7f85bcd2e000 rw-p 00000000 00:00 0
7f85bcd2e000-7f85bcd44000 r-xp 00000000 08:01 1828592                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f85bcd44000-7f85bcf43000 ---p 00016000 08:01 1828592                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f85bcf43000-7f85bcf44000 r--p 00015000 08:01 1828592                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f85bcf44000-7f85bcf45000 rw-p 00016000 08:01 1828592                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f85bcf45000-7f85bd048000 r-xp 00000000 08:01 1828601                    /lib/x86_64-linux-gnu/libm-2.24.so
7f85bd048000-7f85bd247000 ---p 00103000 08:01 1828601                    /lib/x86_64-linux-gnu/libm-2.24.so
7f85bd247000-7f85bd248000 r--p 00102000 08:01 1828601                    /lib/x86_64-linux-gnu/libm-2.24.so
7f85bd248000-7f85bd249000 rw-p 00103000 08:01 1828601                    /lib/x86_64-linux-gnu/libm-2.24.so
7f85bd249000-7f85bd3bb000 r-xp 00000000 08:01 2211105                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7f85bd3bb000-7f85bd5bb000 ---p 00172000 08:01 2211105                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7f85bd5bb000-7f85bd5c5000 r--p 00172000 08:01 2211105                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7f85bd5c5000-7f85bd5c7000 rw-p 0017c000 08:01 2211105                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7f85bd5c7000-7f85bd5cb000 rw-p 00000000 00:00 0
7f85bd5cb000-7f85bd5d2000 r-xp 00000000 08:01 1828639                    /lib/x86_64-linux-gnu/librt-2.24.so
7f85bd5d2000-7f85bd7d1000 ---p 00007000 08:01 1828639                    /lib/x86_64-linux-gnu/librt-2.24.so
7f85bd7d1000-7f85bd7d2000 r--p 00006000 08:01 1828639                    /lib/x86_64-linux-gnu/librt-2.24.so
7f85bd7d2000-7f85bd7d3000 rw-p 00007000 08:01 1828639                    /lib/x86_64-linux-gnu/librt-2.24.so
7f85bd7d3000-7f85bd7d6000 r-xp 00000000 08:01 1827470                    /lib/x86_64-linux-gnu/libdl-2.24.so
7f85bd7d6000-7f85bd9d5000 ---p 00003000 08:01 1827470                    /lib/x86_64-linux-gnu/libdl-2.24.so
7f85bd9d5000-7f85bd9d6000 r--p 00002000 08:01 1827470                    /lib/x86_64-linux-gnu/libdl-2.24.so
7f85bd9d6000-7f85bd9d7000 rw-p 00003000 08:01 1827470                    /lib/x86_64-linux-gnu/libdl-2.24.so
7f85bd9d7000-7f85bd9fa000 r-xp 00000000 08:01 1827242                    /lib/x86_64-linux-gnu/ld-2.24.so
7f85bdbea000-7f85bdbf1000 rw-p 00000000 00:00 0
7f85bdbf4000-7f85bdbf5000 rw-p 00000000 00:00 0
7f85bdbf5000-7f85bdbf6000 ---p 00000000 00:00 0
7f85bdbf6000-7f85bdbfa000 rwxp 00000000 00:00 0
7f85bdbfa000-7f85bdbfb000 r--p 00023000 08:01 1827242                    /lib/x86_64-linux-gnu/ld-2.24.so
7f85bdbfb000-7f85bdbfc000 rw-p 00024000 08:01 1827242                    /lib/x86_64-linux-gnu/ld-2.24.so
7f85bdbfc000-7f85bdbfd000 rw-p 00000000 00:00 0
7ffc075e7000-7ffc07606000 rwxp 00000000 00:00 0                          [stack]
7ffc07606000-7ffc07608000 rw-p 00000000 00:00 0
7ffc07690000-7ffc07693000 r--p 00000000 00:00 0                          [vvar]
7ffc07693000-7ffc07695000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

Wildcard cupport

I saw wildcard support in golang examples, is there same support for this client?

Message ID for produced messages

Hi,
Currently we are not getting any response for a produced message. Is there a way to get the message ID for a message that was produced? If not, can we please have that feature?

Error: Failed to send message: AlreadyClosed

Hi there,
Why this example with 1 second timeout works fine:

const client = new Pulsar.Client({
    serviceUrl: 'pulsar://localhost:6650',
})

const producer = await client.createProducer({
    topic: 'persistent://public/default/my-topic',
})

setTimeout(() => {
    producer.send({
        data: Buffer.from('My Message'),
    })
}, 1000)

But this example with a few more seconds timeout occurs an error?

const client = new Pulsar.Client({
    serviceUrl: 'pulsar://localhost:6650',
})

const producer = await client.createProducer({
    topic: 'persistent://public/default/my-topic',
})

setTimeout(() => {
    producer.send({
        data: Buffer.from('My Message'),
    })
}, 9000)

Full error message:

You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
Error: Failed to send message: AlreadyClosed

Set log level to warn/error by default

Nodejs console prints INFO statistic messages every few seconds like

2019-08-05 10:54:28.285 INFO  ConsumerStatsImpl:64 | Consumer [persistent://public/default/xxx, reader-261478, 0] , ConsumerStatsImpl (numBytesRecieved_ = 0, totalNumBytesRecieved_ = 160101, receivedMsgMap_ = {}, ackedMsgMap_ = {}, totalReceivedMsgMap_ = {[Key: Ok, Value: 292], }, totalAckedMsgMap_ = {[Key: {Result: Ok, ackType: 1}, Value: 292], })

How to mute it or set log level to WARN or ERROR?
Is it possible to set from outside (js code)?

fatal error: pulsar/c/message.h: No such file or directory

Hi there,

I was having a problem trying to install/build the client node. I follow the instructions, git clone and then run the npm install and I get the following:

> [email protected] install /home/ubuntu/pulsar-client-node
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v2.4.0-SNAPSHOT-node-v57-linux-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI, glibc) (falling back to source compile with node-gyp)
make: Entering directory '/home/ubuntu/pulsar-client-node/build'
  CC(target) Release/obj.target/nothing/node_modules/node-addon-api/src/nothing.o
  AR(target) Release/obj.target/node_modules/node-addon-api/src/nothing.a
  COPY Release/nothing.a
  CXX(target) Release/obj.target/Pulsar/src/addon.o
In file included from ../src/addon.cc:20:0:
../src/Message.h:24:10: fatal error: pulsar/c/message.h: No such file or directory
 #include <pulsar/c/message.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
Pulsar.target.mk:114: recipe for target 'Release/obj.target/Pulsar/src/addon.o' failed
make: *** [Release/obj.target/Pulsar/src/addon.o] Error 1
make: Leaving directory '/home/ubuntu/pulsar-client-node/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.15.0-1043-aws
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/ubuntu/pulsar-client-node/build/Release/libpulsar.node" "--module_name=libpulsar" "--module_path=/home/ubuntu/pulsar-client-node/build/Release" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57"
gyp ERR! cwd /home/ubuntu/pulsar-client-node
gyp ERR! node -v v8.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/ubuntu/pulsar-client-node/build/Release/libpulsar.node --module_name=libpulsar --module_path=/home/ubuntu/pulsar-client-node/build/Release --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/ubuntu/pulsar-client-node/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:915:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.15.0-1043-aws
node-pre-gyp ERR! command "/usr/bin/node" "/home/ubuntu/pulsar-client-node/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/ubuntu/pulsar-client-node
node-pre-gyp ERR! node -v v8.16.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/ubuntu/pulsar-client-node/build/Release/libpulsar.node --module_name=libpulsar --module_path=/home/ubuntu/pulsar-client-node/build/Release --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Then I try a npm run build just in case I was crazy, but I get this:


ubuntu:~/pulsar-client-node$ npm run build

> [email protected] build /home/ubuntu/pulsar-client-node
> npm run format && node-gyp rebuild


> [email protected] format /home/ubuntu/pulsar-client-node
> clang-format -i --verbose src/* && eslint --fix --ext .js .

Formatting src/Authentication.cc
Formatting src/Authentication.h
Formatting src/AuthenticationAthenz.js
Formatting src/AuthenticationTls.js
Formatting src/AuthenticationToken.js
Formatting src/Client.cc
Formatting src/Client.h
Formatting src/Consumer.cc
Formatting src/Consumer.h
Formatting src/ConsumerConfig.cc
Formatting src/ConsumerConfig.h
Formatting src/Message.cc
Formatting src/Message.h
Formatting src/MessageId.cc
Formatting src/MessageId.h
Formatting src/Producer.cc
Formatting src/Producer.h
Formatting src/ProducerConfig.cc
Formatting src/ProducerConfig.h
Formatting src/Reader.cc
Formatting src/Reader.h
Formatting src/ReaderConfig.cc
Formatting src/ReaderConfig.h
Formatting src/addon.cc

/home/ubuntu/pulsar-client-node/examples/consumer_tls_auth.js
  44:17  warning  Unexpected `await` inside a loop  no-await-in-loop

/home/ubuntu/pulsar-client-node/examples/consumer.js
  39:17  warning  Unexpected `await` inside a loop  no-await-in-loop

/home/ubuntu/pulsar-client-node/examples/reader.js
  37:17  warning  Unexpected `await` inside a loop  no-await-in-loop

/home/ubuntu/pulsar-client-node/tests/end_to_end.test.js
   59:21  warning  Unexpected `await` inside a loop  no-await-in-loop
  102:21  warning  Unexpected `await` inside a loop  no-await-in-loop
  150:21  warning  Unexpected `await` inside a loop  no-await-in-loop

✖ 6 problems (0 errors, 6 warnings)


┌──────────────────────────────────────────────────────────┐
│                 npm update check failed                  │
│           Try running with sudo or get access            │
│           to the local update config store via           │
│ sudo chown -R $USER:$(id -gn $USER) /home/ubuntu/.config │
└──────────────────────────────────────────────────────────┘
make: Entering directory '/home/ubuntu/pulsar-client-node/build'
  CC(target) Release/obj.target/nothing/node_modules/node-addon-api/src/nothing.o
  AR(target) Release/obj.target/node_modules/node-addon-api/src/nothing.a
  COPY Release/nothing.a
  CXX(target) Release/obj.target/Pulsar/src/addon.o
In file included from ../src/addon.cc:20:0:
../src/Message.h:24:10: fatal error: pulsar/c/message.h: No such file or directory
 #include <pulsar/c/message.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
Pulsar.target.mk:114: recipe for target 'Release/obj.target/Pulsar/src/addon.o' failed
make: *** [Release/obj.target/Pulsar/src/addon.o] Error 1
make: Leaving directory '/home/ubuntu/pulsar-client-node/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.15.0-1043-aws
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ubuntu/pulsar-client-node
gyp ERR! node -v v8.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `npm run format && node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Not sure what I am doing wrong, is there something that I am missing?

node-pre-gyp setup

The current node-pre-gyp setup is incorrect, the binary host points to the docs instead of a place where the built binaries are stored.

Things to do to improve the usage:

  • Set up a CI on Mac OS and Linux (glibc and musl builds?) to build the binaries.
  • Use node-pre-gyp-github tool to upload the built binaries to GitHub releases, so that users can download the binaries during install.
  • This project uses N-API, so the default binary name can be optimised to not include node ABI version in it. This will allow to build a single binary per platform without the need of building it for every node version. "{module_name}-{version}-{platform}-{libc}-{arch}.tar.gz"

subscribe from earliest message

If I have already produced on a topic and then subscribe for the first time - is there a way to get the messages that were already produced at the time of subscription?

Improve Timing of Promise "then"

Currently, To measure latency of sending messages, asynchronous processing using Nodejs Promise like following code:

    const results = [];
    for (let mi = 0; mi < numOfMessages; mi += 1) {
      const startSendTimeMilliSeconds = performance.now();
      results.push(producer.send({
        data: message,
      }).then(() => {
        // add latency
        histogram.recordValue((performance.now() - startSendTimeMilliSeconds));
      }));
    }
    await Promise.all(results); // wait until all messages are sent.

https://github.com/apache/pulsar-client-node/blob/master/perf/perf_producer.js#L88-L98

This code creates histogram about latency of sending messages.
However, all then() of Promise in results start after await Promise.all(results).
So, We cannot get accurate histogram.

Create Documents

Create documents in Pulsar Docs

  • Installation
  • Connection URLs
  • Creating a client
  • Producers
  • Consumers
  • Readers
  • Messages
  • TLS encryption and authentication

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.