pulsar-client 1.7.0 → 1.8.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.asf.yaml +8 -1
  2. package/.github/PULL_REQUEST_TEMPLATE.md +85 -0
  3. package/.github/workflows/ci-build-release-napi.yml +213 -0
  4. package/.github/workflows/ci-pr-validation.yml +233 -0
  5. package/README.md +86 -106
  6. package/binding.gyp +34 -43
  7. package/{pulsar-test-service-stop.sh → build-support/dep-version.py} +4 -6
  8. package/build-support/download-release-artifacts.py +74 -0
  9. package/build-support/generate-source-archive.sh +28 -0
  10. package/{pulsar-test-service-start.sh → build-support/pulsar-test-container-start.sh} +11 -21
  11. package/build-support/pulsar-test-service-start.sh +37 -0
  12. package/build-support/pulsar-test-service-stop.sh +32 -0
  13. package/{.github/workflows/nodejs.yml → build-support/sign-files.sh} +13 -12
  14. package/build-support/stage-release.sh +44 -0
  15. package/dependencies.yaml +28 -0
  16. package/docs/release-process.md +271 -0
  17. package/examples/consumer.js +1 -1
  18. package/examples/consumer_listener.js +1 -1
  19. package/examples/consumer_tls_auth.js +1 -1
  20. package/examples/custom_logger.js +60 -0
  21. package/examples/encryption-consumer.js +1 -1
  22. package/examples/encryption-producer.js +1 -1
  23. package/examples/producer.js +1 -1
  24. package/examples/producer_tls_auth.js +1 -1
  25. package/examples/reader.js +1 -1
  26. package/examples/reader_listener.js +1 -1
  27. package/index.d.ts +7 -0
  28. package/index.js +2 -1
  29. package/package.json +17 -8
  30. package/pkg/linux/Dockerfile_linux_glibc +35 -0
  31. package/pkg/linux/Dockerfile_linux_musl +32 -0
  32. package/pkg/linux/build-napi-inside-docker.sh +31 -0
  33. package/pkg/linux/download-cpp-client.sh +65 -0
  34. package/pkg/load_test.js +34 -0
  35. package/pkg/mac/build-cpp-deps-lib.sh +186 -0
  36. package/pkg/mac/build-cpp-lib.sh +48 -0
  37. package/pkg/mac/common.sh +37 -0
  38. package/pkg/windows/download-cpp-client.bat +12 -0
  39. package/pulsar-client-cpp.txt +2 -0
  40. package/src/AuthenticationAthenz.js +1 -1
  41. package/src/AuthenticationOauth2.js +1 -1
  42. package/src/AuthenticationTls.js +1 -1
  43. package/src/AuthenticationToken.js +1 -1
  44. package/src/Consumer.cc +72 -4
  45. package/src/Consumer.h +2 -0
  46. package/src/ConsumerConfig.cc +21 -0
  47. package/src/ProducerConfig.cc +6 -0
  48. package/src/Reader.cc +51 -1
  49. package/src/Reader.h +2 -0
  50. package/src/pulsar-binding.js +26 -0
  51. package/tests/conf/standalone.conf +6 -0
  52. package/tests/docker-load-test.sh +35 -0
  53. package/tests/end_to_end.test.js +212 -0
  54. package/{run-unit-tests.sh → tests/load-test.sh} +18 -19
  55. package/{docker-tests.sh → tests/run-unit-tests.sh} +10 -13
  56. package/pulsar-version.txt +0 -1
@@ -0,0 +1,28 @@
1
+ #
2
+ # Licensed to the Apache Software Foundation (ASF) under one
3
+ # or more contributor license agreements. See the NOTICE file
4
+ # distributed with this work for additional information
5
+ # regarding copyright ownership. The ASF licenses this file
6
+ # to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance
8
+ # with the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing,
13
+ # software distributed under the License is distributed on an
14
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ # KIND, either express or implied. See the License for the
16
+ # specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+
20
+ # Only used for MacOS builds
21
+ boost: 1.80.0
22
+ cmake: 3.24.2
23
+ protobuf: 3.20.0
24
+ zlib: 1.2.13
25
+ zstd: 1.5.2
26
+ snappy: 1.1.9
27
+ openssl: 1.1.1s
28
+ curl: 7.85.0
@@ -0,0 +1,271 @@
1
+ <!--
2
+
3
+ Licensed to the Apache Software Foundation (ASF) under one
4
+ or more contributor license agreements. See the NOTICE file
5
+ distributed with this work for additional information
6
+ regarding copyright ownership. The ASF licenses this file
7
+ to you under the Apache License, Version 2.0 (the
8
+ "License"); you may not use this file except in compliance
9
+ with the License. You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing,
14
+ software distributed under the License is distributed on an
15
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ KIND, either express or implied. See the License for the
17
+ specific language governing permissions and limitations
18
+ under the License.
19
+
20
+ -->
21
+ This page contains instructions for Pulsar committers on how to perform a release.
22
+
23
+ ## Making the release
24
+
25
+ The steps for releasing are as follows:
26
+ 1. Check and Add TypeScript Types
27
+ 2. Create the release branch
28
+ 3. Update package version and tag
29
+ 4. Sign and stage the artifacts
30
+ 5. Move master branch to next version
31
+ 6. Publish the release candidate to the npm
32
+ 7. Run the vote
33
+ 8. Promote the release
34
+ 9. Add release notes
35
+ 10. Announce the release
36
+
37
+ ## Requirements
38
+ If you haven't already done it, [create and publish the GPG key](https://pulsar.apache.org/contribute/releasing/create-gpg-keys) to sign the release artifacts.
39
+
40
+ ## Steps in detail
41
+
42
+ #### 1. Check and Add TypeScript Types
43
+
44
+ In order to use added features and options in TypeScript code, we need to add their type definitions.
45
+
46
+ Check if there are any Pull Requests with the `types-required` label or not.
47
+ If yes, add their type definitions (e.g. https://github.com/apache/pulsar-client-node/pull/157).
48
+ If no, we can then proceed to next step.
49
+
50
+ #### 2. Create the release branch
51
+
52
+ We are going to create a branch from `master` to `branch-1.X` where the tag will be generated
53
+ and where new fixes will be applied as part of the maintenance for the release.
54
+
55
+ The branch needs only to be created when creating minor releases, and not for patch releases.
56
+
57
+ Eg: When creating `v1.1.0` release, will be creating the branch `branch-1.1`,
58
+ but for `v1.1.1` we would keep using the old `branch-1.1`.
59
+
60
+ In these instructions, I'm referring to an fictitious release `1.X.0`.
61
+ Change the release version in the examples accordingly with the real version.
62
+
63
+ It is recommended to create a fresh clone of the repository to avoid any local files to interfere
64
+ in the process:
65
+
66
+ ```sh
67
+ $ git clone git@github.com:apache/pulsar-client-node.git
68
+ $ cd pulsar-client-node
69
+ $ git checkout -b branch-1.X origin/master
70
+ ```
71
+
72
+ #### 3. Update package version and tag
73
+
74
+ During the release process, we are going to initially create "candidate" tags:
75
+ ```sh
76
+ # Bump to the release version (the suffix "-rc.0" is removed)
77
+ $ npm version patch --no-git-tag-version
78
+ $ git add .
79
+ $ git commit -m 'Release v1.x.0'
80
+
81
+ # Create a "candidate" tag
82
+ $ export GPG_TTY=$(tty)
83
+ $ git tag -u $USER@apache.org v1.X.0-rc.1 -m 'Release v1.X.0-rc.1'
84
+
85
+ # Push both the branch and the tag to GitHub repo
86
+ $ git push origin branch-1.X
87
+ $ git push origin v1.X.0-rc.1
88
+ ```
89
+
90
+ #### 4. Sign and stage the artifacts
91
+ The src artifact need to be signed and uploaded to the dist SVN repository for staging. See [here](https://github.com/apache/pulsar/wiki/Create-GPG-keys-to-sign-release-artifacts) for how to setup gpg.
92
+
93
+ When the build is pushed to the Apache repo, a Github action job will run and build all the binary artifacts.
94
+
95
+ The build will be available at `https://github.com/apache/pulsar-client-node/actions`
96
+
97
+ Once the workflow is completed (ETA ~20 min), the artifacts will be available for download.
98
+
99
+ Record the id of the workflow as `WORKFLOW_ID`.
100
+
101
+ All the artifacts need to be signed and uploaded to the dist SVN repository for staging.
102
+
103
+ Before running the script, make sure that the `user@apache.org` code signing key is the default gpg signing key. One way to ensure this is to create/edit file `~/.gnupg/gpg.conf` and add a line
104
+
105
+ ```sh
106
+ default-key <key fingerprint>
107
+ ```
108
+
109
+ where` <key fingerprint>` should be replaced with the private key fingerprint for the `user@apache.org` key. The key fingerprint can be found in `gpg -K` output.
110
+
111
+ ```sh
112
+ $ svn co https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-node pulsar-dist-dev
113
+ $ cd pulsar-dist-dev
114
+
115
+ # '-candidate-1' needs to be incremented in case of multiple iterations in getting
116
+ # to the final release)
117
+ $ svn mkdir pulsar-client-node-1.X.0-rc.1
118
+ $ cd pulsar-client-node-1.X.0-rc.1
119
+
120
+ # Generate token from here: https://github.com/settings/tokens
121
+ $ export GITHUB_TOKEN=${Your github token}
122
+ $ $PULSAR_PATH/build-support/stage-release.sh . $WORKFLOW_ID
123
+
124
+ $ svn add *
125
+ $ svn ci -m 'Staging artifacts and signature for Pulsar Node.js client release 1.X.0-rc.1'
126
+ ```
127
+
128
+ #### 5. Move master branch to next version
129
+
130
+ We need to move master version to next iteration `X + 1`.
131
+
132
+ ```sh
133
+ $ git checkout master
134
+ $ npm version preminor --preid=rc
135
+ ```
136
+
137
+ Since this needs to be merged in `master`, we need to follow the regular process
138
+ and create a Pull Request on GitHub.
139
+
140
+ #### 6. Publish the release candidate to the npm
141
+
142
+ Set the npm version for the release candidate
143
+ ```sh
144
+ npm version 1.8.0-rc.1 --no-git-tag-version
145
+ ```
146
+
147
+ You can use `npm pack` and test the package before publishing.
148
+ If there are no problems, then use `npm publish` to publish to the npm.
149
+
150
+ #### 7. Run the vote
151
+
152
+ Send an email on the Pulsar Dev mailing list:
153
+
154
+ ```
155
+ To: dev@pulsar.apache.org
156
+ Subject: [VOTE] Pulsar Node.js Client Release 1.X.0 Candidate 1
157
+
158
+ Hi everyone,
159
+
160
+ This is the first release candidate for Apache Pulsar Node.js client, version 1.X.0.
161
+
162
+ It fixes the following issues:
163
+ https://github.com/apache/pulsar-client-node/milestone/1?closed=1
164
+
165
+ Please download the source files and review this release candidate:
166
+ - Download the source package, verify shasum and asc
167
+ - Follow the README.md to build and run the Pulsar Node.js client.
168
+
169
+ The release candidate package has been published to the npm registry:
170
+ https://www.npmjs.com/package/pulsar-client/v/1.X.0-rc.1
171
+ You can install it by `npm i pulsar-client@1.X.0-rc.1 --pulsar_binary_host_mirror=https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-node/` and verify the package.
172
+
173
+ The vote will be open for at least 72 hours. It is adopted by majority approval, with at least 3 PMC affirmative votes.
174
+
175
+ Source files:
176
+ https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-node/pulsar-client-node-1.X.0-rc.1/
177
+
178
+ Pulsar's KEYS file containing PGP keys we use to sign the release:
179
+ https://dist.apache.org/repos/dist/dev/pulsar/KEYS
180
+
181
+ SHA-512 checksum:
182
+ 5f6c7e1a096a3ae66eee71c552af89532ed86bf94da3f3d49836c080426ee5dcaabeda440a989d51772d2e67e2dca953eeee9ea83cfbc7c2a0847a0ec04b310f pulsar-client-node-1.X.0.tar.gz
183
+
184
+ The tag to be voted upon:
185
+ v1.X.0-rc.1
186
+ https://github.com/apache/pulsar-client-node/releases/tag/v1.X.0-rc.1
187
+
188
+ Please review and vote on the release candidate #1 for the version 1.X.0, as follows:
189
+ [ ] +1, Approve the release
190
+ [ ] -1, Do not approve the release (please provide specific comments)
191
+ ```
192
+
193
+ The vote should be open for at least 72 hours (3 days). Votes from Pulsar PMC members
194
+ will be considered binding, while anyone else is encouraged to verify the release and
195
+ vote as well.
196
+
197
+ If the release is approved here, we can then proceed to next step.
198
+
199
+ #### 8. Promote the release
200
+
201
+ Create the final git tag:
202
+ ```sh
203
+ $ git checkout branch-1.X
204
+ $ export GPG_TTY=$(tty)
205
+ $ git tag -u $USER@apache.org v1.X.0 -m 'Release v1.X.0'
206
+ $ git push origin v1.X.0
207
+ ```
208
+
209
+ Publish the release package:
210
+ ```sh
211
+ # Create or verify a user account in the npm registry
212
+ $ npm adduser
213
+
214
+ Username: foobar
215
+ Password: ********
216
+ Email: (this IS public) foobar@apache.org
217
+
218
+ # Publish the package to the npm registry
219
+ $ npm publish
220
+
221
+ # If you don't have permission to publish `pulsar-client` to the npm registry,
222
+ # ask other committers to grant that permission.
223
+ ```
224
+
225
+ Promote the artifacts on the release location (need PMC permissions):
226
+ ```sh
227
+ $ svn mv -m 'Release Pulsar Node.js client 1.X.0' \
228
+ https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-node/pulsar-client-node-1.X.0-rc.1 \
229
+ https://dist.apache.org/repos/dist/release/pulsar/pulsar-client-node/pulsar-client-node-1.X.0
230
+
231
+ # Remove the old releases (if any)
232
+ # We only need the latest release there, older releases are available through the Apache archive
233
+ $ svn rm -m 'Remove the old release' \
234
+ https://dist.apache.org/repos/dist/release/pulsar/pulsar-client-node/pulsar-client-node-1.Y.0
235
+ ```
236
+
237
+ #### 9. Add release notes
238
+
239
+ Create a PR to add release notes to the pulsar site. Here is the example: https://github.com/apache/pulsar-site/pull/360
240
+ If there are any new contributors for this release, please add a `New Contributors` section in the release note.
241
+
242
+ Once the PR has been approved, add release notes to the Github release page (https://github.com/apache/pulsar-client-node/releases)
243
+
244
+ #### 10. Announce the release
245
+
246
+ Once the release artifact is available in the npm registry, we need to announce the release.
247
+
248
+ Send an email on these lines:
249
+ ```
250
+ To: dev@pulsar.apache.org, users@pulsar.apache.org, announce@apache.org
251
+ Subject: [ANNOUNCE] Apache Pulsar Node.js client 1.X.0 released
252
+
253
+ The Apache Pulsar team is proud to announce Apache Pulsar Node.js client version 1.X.0.
254
+
255
+ Pulsar is a highly scalable, low latency messaging platform running on
256
+ commodity hardware. It provides simple pub-sub semantics over topics,
257
+ guaranteed at-least-once delivery of messages, automatic cursor management for
258
+ subscribers, and cross-datacenter replication.
259
+
260
+ For Pulsar Node.js client release details and downloads, visit:
261
+ https://www.npmjs.com/package/pulsar-client
262
+
263
+ Release Notes are at:
264
+ https://github.com/apache/pulsar-client-node/releases
265
+
266
+ We would like to thank the contributors that made the release possible.
267
+
268
+ Regards,
269
+
270
+ The Pulsar Team
271
+ ```
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  const auth = new Pulsar.AuthenticationTls({
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ const Pulsar = require('..');
21
+
22
+ (async () => {
23
+ // Create a client
24
+ const client = new Pulsar.Client({
25
+ serviceUrl: 'pulsar://localhost:6650',
26
+ operationTimeoutSeconds: 30,
27
+ });
28
+
29
+ Pulsar.Client.setLogHandler((level, file, line, message) => {
30
+ console.log('[%s][%s:%d] %s', Pulsar.LogLevel.toString(level), file, line, message);
31
+ });
32
+
33
+ // Create a producer
34
+ const producer = await client.createProducer({
35
+ topic: 'persistent://public/default/my-topic',
36
+ sendTimeoutMs: 30000,
37
+ batchingEnabled: true,
38
+ });
39
+
40
+ // Create a consumer
41
+ const consumer = await client.subscribe({
42
+ topic: 'persistent://public/default/my-topic',
43
+ subscription: 'sub1',
44
+ subscriptionType: 'Shared',
45
+ ackTimeoutMs: 10000,
46
+ });
47
+
48
+ const msg = `my-message`;
49
+ await producer.send({
50
+ data: Buffer.from(msg),
51
+ });
52
+
53
+ const receivedMsg = await consumer.receive();
54
+ console.log(receivedMsg.getData().toString());
55
+ await consumer.acknowledge(receivedMsg);
56
+
57
+ await producer.close();
58
+ await consumer.close();
59
+ await client.close();
60
+ })();
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  const auth = new Pulsar.AuthenticationTls({
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const Pulsar = require('pulsar-client');
20
+ const Pulsar = require('../');
21
21
 
22
22
  (async () => {
23
23
  // Create a client
package/index.d.ts CHANGED
@@ -60,6 +60,7 @@ export interface ProducerConfig {
60
60
  publicKeyPath?: string;
61
61
  encryptionKey?: string;
62
62
  cryptoFailureAction?: ProducerCryptoFailureAction;
63
+ chunkingEnabled?: boolean;
63
64
  }
64
65
 
65
66
  export class Producer {
@@ -88,6 +89,8 @@ export interface ConsumerConfig {
88
89
  readCompacted?: boolean;
89
90
  privateKeyPath?: string;
90
91
  cryptoFailureAction?: ConsumerCryptoFailureAction;
92
+ maxPendingChunkedMessage?: number;
93
+ autoAckOldestChunkedMessageOnQueueFull?: number;
91
94
  }
92
95
 
93
96
  export class Consumer {
@@ -98,6 +101,8 @@ export class Consumer {
98
101
  negativeAcknowledgeId(messageId: MessageId): void;
99
102
  acknowledgeCumulative(message: Message): Promise<null>;
100
103
  acknowledgeCumulativeId(messageId: MessageId): Promise<null>;
104
+ seek(messageId: MessageId): Promise<null>;
105
+ seekTimestamp(timestamp: number): Promise<null>;
101
106
  isConnected(): boolean;
102
107
  close(): Promise<null>;
103
108
  unsubscribe(): Promise<null>;
@@ -117,6 +122,8 @@ export class Reader {
117
122
  readNext(timeout?: number): Promise<Message>;
118
123
  hasNext(): boolean;
119
124
  isConnected(): boolean;
125
+ seek(messageId: MessageId): Promise<null>;
126
+ seekTimestamp(timestamp: number): Promise<null>;
120
127
  close(): Promise<null>;
121
128
  }
122
129
 
package/index.js CHANGED
@@ -17,7 +17,7 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
- const PulsarBinding = require('bindings')('Pulsar');
20
+ const PulsarBinding = require('./src/pulsar-binding');
21
21
  const AuthenticationTls = require('./src/AuthenticationTls.js');
22
22
  const AuthenticationAthenz = require('./src/AuthenticationAthenz.js');
23
23
  const AuthenticationToken = require('./src/AuthenticationToken.js');
@@ -28,6 +28,7 @@ const LogLevel = {
28
28
  INFO: 1,
29
29
  WARN: 2,
30
30
  ERROR: 3,
31
+ toString: (level) => Object.keys(LogLevel).find((key) => LogLevel[key] === level),
31
32
  };
32
33
 
33
34
  const Pulsar = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pulsar-client",
3
- "version": "1.7.0",
3
+ "version": "1.8.0-rc.1",
4
4
  "description": "Pulsar Node.js client",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -9,17 +9,17 @@
9
9
  "example": "examples"
10
10
  },
11
11
  "scripts": {
12
- "install": "node-gyp rebuild",
13
- "clean": "node-gyp clean",
14
- "configure": "node-gyp configure",
12
+ "install": "node-pre-gyp install --fallback-to-build",
13
+ "configure": "node-pre-gyp configure",
14
+ "build": "npm run format && node-pre-gyp build",
15
+ "build:debug": "npm run format && node-pre-gyp rebuild --debug",
16
+ "clean": "node-pre-gyp clean",
15
17
  "lint": "clang-format-lint src/*.cc src/*.h && eslint --ext .js .",
16
18
  "format": "clang-format-lint --fix src/*.cc src/*.h && eslint --fix --ext .js .",
17
19
  "dtslint": "dtslint .",
18
- "build": "npm run format && node-gyp rebuild",
19
- "build:debug": "npm run format && node-gyp rebuild --debug",
20
20
  "license:report": "mkdir -p report && grunt grunt-license-report",
21
21
  "license:addheader": "license-check-and-add",
22
- "test": "jest --verbose"
22
+ "test": "jest --verbose --detectOpenHandles"
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
@@ -52,9 +52,17 @@
52
52
  "typescript": "^4.1.3"
53
53
  },
54
54
  "dependencies": {
55
+ "@mapbox/node-pre-gyp": "^1.0.9",
55
56
  "bindings": "^1.5.0",
56
57
  "node-addon-api": "^4.3.0"
57
58
  },
59
+ "binary": {
60
+ "module_name": "pulsar",
61
+ "module_path": "./lib/binding/",
62
+ "host": "https://archive.apache.org/dist/pulsar/pulsar-client-node/",
63
+ "remote_path": "pulsar-client-node-{version}",
64
+ "package_name": "napi-{platform}-{libc}-{arch}.tar.gz"
65
+ },
58
66
  "license-check-and-add-config": {
59
67
  "folder": ".",
60
68
  "license": "license-header.txt",
@@ -71,7 +79,8 @@
71
79
  ".json",
72
80
  ".pem",
73
81
  ".txt",
74
- ".gz"
82
+ ".gz",
83
+ ".bat"
75
84
  ],
76
85
  "trailing_whitespace": "TRIM",
77
86
  "insert_license": true,
@@ -0,0 +1,35 @@
1
+ #
2
+ # Licensed to the Apache Software Foundation (ASF) under one
3
+ # or more contributor license agreements. See the NOTICE file
4
+ # distributed with this work for additional information
5
+ # regarding copyright ownership. The ASF licenses this file
6
+ # to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance
8
+ # with the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing,
13
+ # software distributed under the License is distributed on an
14
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ # KIND, either express or implied. See the License for the
16
+ # specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+
20
+ FROM centos:7
21
+
22
+ RUN yum update -y
23
+ RUN yum install -y gcc gcc-c++ make python3
24
+
25
+ WORKDIR /app
26
+ ARG PLATFORM
27
+ RUN SUFFIX=$(echo ${PLATFORM} | sed 's/86_//') && \
28
+ echo $SUFFIX && \
29
+ curl -O -L https://nodejs.org/download/release/v16.19.0/node-v16.19.0-linux-$SUFFIX.tar.gz && \
30
+ tar zxf node-v16.19.0-linux-$SUFFIX.tar.gz && \
31
+ mv node-v16.19.0-linux-$SUFFIX node-v16.19.0
32
+
33
+ ENV PATH="/app/node-v16.19.0/bin:$PATH"
34
+
35
+ CMD ["sh"]
@@ -0,0 +1,32 @@
1
+ #
2
+ # Licensed to the Apache Software Foundation (ASF) under one
3
+ # or more contributor license agreements. See the NOTICE file
4
+ # distributed with this work for additional information
5
+ # regarding copyright ownership. The ASF licenses this file
6
+ # to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance
8
+ # with the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing,
13
+ # software distributed under the License is distributed on an
14
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ # KIND, either express or implied. See the License for the
16
+ # specific language governing permissions and limitations
17
+ # under the License.
18
+ #
19
+
20
+ ARG NODE_VERSION
21
+
22
+ FROM node:${NODE_VERSION}-alpine
23
+
24
+ RUN apk add \
25
+ bash \
26
+ curl \
27
+ python3 \
28
+ make \
29
+ g++ \
30
+ sudo
31
+
32
+ CMD ["sh"]
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ #
20
+
21
+ set -e -x
22
+
23
+ cd /pulsar-client-node
24
+
25
+ pkg/linux/download-cpp-client.sh
26
+
27
+ npm install --ignore-scripts
28
+ npx node-pre-gyp configure
29
+ npx node-pre-gyp build
30
+ npx node-pre-gyp package
31
+ node pkg/load_test.js