pulsar-client 1.8.0 → 1.8.1-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.
@@ -127,7 +127,7 @@ jobs:
127
127
  - name: Build Linux Docker image
128
128
  uses: docker/build-push-action@v3
129
129
  with:
130
- context: ./pkg/${{matrix.image}}
130
+ file: ./pkg/linux/Dockerfile_${{matrix.image}}
131
131
  load: true
132
132
  tags: build:latest
133
133
  platforms: linux/${{matrix.cpu.arch}}
@@ -141,7 +141,7 @@ jobs:
141
141
  - name: Build and Test NAPI file
142
142
  run: |
143
143
  docker run -i -v $PWD:/pulsar-client-node build:latest \
144
- /pulsar-client-node/pkg/build-napi-inside-docker.sh
144
+ /pulsar-client-node/pkg/linux/build-napi-inside-docker.sh
145
145
 
146
146
  - name: Upload artifacts
147
147
  uses: actions/upload-artifact@v3
@@ -151,7 +151,7 @@ jobs:
151
151
  - name: Build Linux Docker image
152
152
  uses: docker/build-push-action@v3
153
153
  with:
154
- context: ./pkg/${{matrix.image}}
154
+ file: ./pkg/linux/Dockerfile_${{matrix.image}}
155
155
  load: true
156
156
  tags: build:latest
157
157
  platforms: linux/${{matrix.cpu.arch}}
@@ -165,7 +165,15 @@ jobs:
165
165
  - name: Build and Test NAPI file
166
166
  run: |
167
167
  docker run -i -v $PWD:/pulsar-client-node build:latest \
168
- /pulsar-client-node/pkg/build-napi-inside-docker.sh
168
+ /pulsar-client-node/pkg/linux/build-napi-inside-docker.sh
169
+
170
+ - name: Test NAPI file in other containers
171
+ if: matrix.image == 'linux_glibc'
172
+ run: |
173
+ ./tests/load-test.sh node:16-buster ${{matrix.cpu.platform}}
174
+ ./tests/load-test.sh node:16-bullseye ${{matrix.cpu.platform}}
175
+ ./tests/load-test.sh node:19-buster ${{matrix.cpu.platform}}
176
+ ./tests/load-test.sh node:19-bullseye ${{matrix.cpu.platform}}
169
177
 
170
178
  windows-napi:
171
179
  name: Build NAPI windows - Node ${{matrix.nodejs}} - ${{matrix.arch}}
package/README.md CHANGED
@@ -94,6 +94,10 @@ You can see more examples in the [examples](./examples) directory. However, sinc
94
94
 
95
95
  ## How to build
96
96
 
97
+ > **Note**
98
+ >
99
+ > Build from source code requires the Node.js version greater than 16.18
100
+
97
101
  First, clone the repository.
98
102
 
99
103
  ```shell
@@ -106,7 +110,7 @@ Since this client is a [C++ addon](https://nodejs.org/api/addons.html#c-addons)
106
110
  - Install C++ client on Linux:
107
111
 
108
112
  ```shell
109
- build-support/install-cpp-client.sh
113
+ pkg/linux/download-cpp-client.sh
110
114
  ```
111
115
 
112
116
  - Install C++ client on Windows:
package/binding.gyp CHANGED
@@ -20,7 +20,7 @@
20
20
  {
21
21
  "targets": [
22
22
  {
23
- "target_name": "Pulsar",
23
+ "target_name": "pulsar",
24
24
  "cflags_cc": ["-std=gnu++11"],
25
25
  "cflags!": ["-fno-exceptions"],
26
26
  "cflags_cc!": ["-fno-exceptions", "-std=gnu++14", "-std=gnu++17"],
@@ -60,6 +60,9 @@
60
60
  "include_dirs": [
61
61
  "pkg/mac/build-pulsar/install/include"
62
62
  ],
63
+ "libraries": [
64
+ "../pkg/mac/build-pulsar/install/lib/libpulsarwithdeps.a"
65
+ ],
63
66
  }],
64
67
  ['OS=="win"', {
65
68
  "defines": [
@@ -80,12 +83,16 @@
80
83
  "dependencies": [
81
84
  "<!(node -p \"require('node-addon-api').gyp\")"
82
85
  ]
83
- }, { # 'OS!="win"'
86
+ }],
87
+ ['OS=="linux"', {
84
88
  "dependencies": [
85
89
  "<!@(node -p \"require('node-addon-api').gyp\")"
86
90
  ],
91
+ "include_dirs": [
92
+ "pkg/linux/pulsar-cpp/include"
93
+ ],
87
94
  "libraries": [
88
- "../pkg/lib/libpulsarwithdeps.a"
95
+ "../pkg/linux/pulsar-cpp/lib/libpulsarwithdeps.a"
89
96
  ],
90
97
  }]
91
98
  ]
@@ -28,10 +28,10 @@ The steps for releasing are as follows:
28
28
  3. Update package version and tag
29
29
  4. Sign and stage the artifacts
30
30
  5. Move master branch to next version
31
- 6. Write release notes
31
+ 6. Publish the release candidate to the npm
32
32
  7. Run the vote
33
33
  8. Promote the release
34
- 9. Update release notes
34
+ 9. Add release notes
35
35
  10. Announce the release
36
36
 
37
37
  ## Requirements
@@ -114,14 +114,15 @@ $ cd pulsar-dist-dev
114
114
 
115
115
  # '-candidate-1' needs to be incremented in case of multiple iterations in getting
116
116
  # to the final release)
117
- $ svn mkdir pulsar-client-node-1.X.0-candidate-1
117
+ $ svn mkdir pulsar-client-node-1.X.0-rc.1
118
+ $ cd pulsar-client-node-1.X.0-rc.1
118
119
 
119
120
  # Generate token from here: https://github.com/settings/tokens
120
121
  $ export GITHUB_TOKEN=${Your github token}
121
122
  $ $PULSAR_PATH/build-support/stage-release.sh . $WORKFLOW_ID
122
123
 
123
124
  $ svn add *
124
- $ svn ci -m 'Staging artifacts and signature for Pulsar Node.js client release 1.X.0-candidate-1'
125
+ $ svn ci -m 'Staging artifacts and signature for Pulsar Node.js client release 1.X.0-rc.1'
125
126
  ```
126
127
 
127
128
  #### 5. Move master branch to next version
@@ -136,14 +137,15 @@ $ npm version preminor --preid=rc
136
137
  Since this needs to be merged in `master`, we need to follow the regular process
137
138
  and create a Pull Request on GitHub.
138
139
 
139
- #### 6. Write release notes
140
+ #### 6. Publish the release candidate to the npm
140
141
 
141
- Check the milestone in GitHub associated with the release.
142
- https://github.com/apache/pulsar-client-node/milestones?closed=1
142
+ Set the npm version for the release candidate
143
+ ```sh
144
+ npm version 1.8.0-rc.1 --no-git-tag-version
145
+ ```
143
146
 
144
- In the release item, add the list of most important changes that happened in the release
145
- and a link to the associated milestone, with the complete list of all the changes.
146
- https://github.com/apache/pulsar-client-node/releases
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.
147
149
 
148
150
  #### 7. Run the vote
149
151
 
@@ -154,9 +156,6 @@ To: dev@pulsar.apache.org
154
156
  Subject: [VOTE] Pulsar Node.js Client Release 1.X.0 Candidate 1
155
157
 
156
158
  Hi everyone,
157
- Please review and vote on the release candidate #1 for the version 1.X.0, as follows:
158
- [ ] +1, Approve the release
159
- [ ] -1, Do not approve the release (please provide specific comments)
160
159
 
161
160
  This is the first release candidate for Apache Pulsar Node.js client, version 1.X.0.
162
161
 
@@ -164,13 +163,17 @@ It fixes the following issues:
164
163
  https://github.com/apache/pulsar-client-node/milestone/1?closed=1
165
164
 
166
165
  Please download the source files and review this release candidate:
167
- - Review release notes
168
- - Download the source package (verify shasum and asc) and follow the README.md to build and run the Pulsar Node.js client.
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.
169
172
 
170
173
  The vote will be open for at least 72 hours. It is adopted by majority approval, with at least 3 PMC affirmative votes.
171
174
 
172
175
  Source files:
173
- https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-node/pulsar-client-node-1.X.0-candidate-1/
176
+ https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-node/pulsar-client-node-1.X.0-rc.1/
174
177
 
175
178
  Pulsar's KEYS file containing PGP keys we use to sign the release:
176
179
  https://dist.apache.org/repos/dist/dev/pulsar/KEYS
@@ -181,6 +184,10 @@ SHA-512 checksum:
181
184
  The tag to be voted upon:
182
185
  v1.X.0-rc.1
183
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)
184
191
  ```
185
192
 
186
193
  The vote should be open for at least 72 hours (3 days). Votes from Pulsar PMC members
@@ -218,7 +225,7 @@ $ npm publish
218
225
  Promote the artifacts on the release location (need PMC permissions):
219
226
  ```sh
220
227
  $ svn mv -m 'Release Pulsar Node.js client 1.X.0' \
221
- https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-node/pulsar-client-node-1.X.0-candidate-1 \
228
+ https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-node/pulsar-client-node-1.X.0-rc.1 \
222
229
  https://dist.apache.org/repos/dist/release/pulsar/pulsar-client-node/pulsar-client-node-1.X.0
223
230
 
224
231
  # Remove the old releases (if any)
@@ -227,10 +234,12 @@ $ svn rm -m 'Remove the old release' \
227
234
  https://dist.apache.org/repos/dist/release/pulsar/pulsar-client-node/pulsar-client-node-1.Y.0
228
235
  ```
229
236
 
230
- #### 9. Update release notes
237
+ #### 9. Add release notes
231
238
 
232
- Add the release notes there:
233
- https://github.com/apache/pulsar-client-node/releases
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)
234
243
 
235
244
  #### 10. Announce the release
236
245
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pulsar-client",
3
- "version": "1.8.0",
3
+ "version": "1.8.1-rc.1",
4
4
  "description": "Pulsar Node.js client",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -57,9 +57,9 @@
57
57
  "node-addon-api": "^4.3.0"
58
58
  },
59
59
  "binary": {
60
- "module_name": "Pulsar",
60
+ "module_name": "pulsar",
61
61
  "module_path": "./lib/binding/",
62
- "host": "https://dist.apache.org/repos/dist/release/pulsar/pulsar-client-node/",
62
+ "host": "https://archive.apache.org/dist/pulsar/pulsar-client-node/",
63
63
  "remote_path": "pulsar-client-node-{version}",
64
64
  "package_name": "napi-{platform}-{libc}-{arch}.tar.gz"
65
65
  },
@@ -17,17 +17,19 @@
17
17
  # under the License.
18
18
  #
19
19
 
20
- ARG NODE_VERSION
20
+ FROM centos:7
21
21
 
22
- FROM node:${NODE_VERSION}-bullseye
22
+ RUN yum update -y
23
+ RUN yum install -y gcc gcc-c++ make python3
23
24
 
24
- ARG NODE_VERSION
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
25
32
 
26
- RUN apt-get update -y && \
27
- apt-get install -y \
28
- curl \
29
- g++ \
30
- make \
31
- python3
33
+ ENV PATH="/app/node-v16.19.0/bin:$PATH"
32
34
 
33
35
  CMD ["sh"]
@@ -22,7 +22,7 @@ set -e -x
22
22
 
23
23
  cd /pulsar-client-node
24
24
 
25
- build-support/install-cpp-client.sh
25
+ pkg/linux/download-cpp-client.sh
26
26
 
27
27
  npm install --ignore-scripts
28
28
  npx node-pre-gyp configure
@@ -20,7 +20,7 @@
20
20
 
21
21
  set -e -x
22
22
 
23
- ROOT_DIR=`cd $(dirname $0) && cd .. && pwd`
23
+ ROOT_DIR=`cd $(dirname $0) && cd ../../ && pwd`
24
24
  source $ROOT_DIR/pulsar-client-cpp.txt
25
25
 
26
26
  if [ $USER != "root" ]; then
@@ -29,9 +29,6 @@ fi
29
29
 
30
30
  # Get the flavor of Linux
31
31
  export $(cat /etc/*-release | grep "^ID=")
32
-
33
- cd /tmp
34
-
35
32
  UNAME_ARCH=$(uname -m)
36
33
  if [ $UNAME_ARCH == 'aarch64' ]; then
37
34
  PLATFORM=arm64
@@ -39,28 +36,30 @@ else
39
36
  PLATFORM=x86_64
40
37
  fi
41
38
 
39
+ rm -rf $ROOT_DIR/pkg/linux/pulsar-cpp
40
+ mkdir $ROOT_DIR/pkg/linux/pulsar-cpp
41
+ rm -rf $ROOT_DIR/pkg/linux/tmp
42
+ mkdir $ROOT_DIR/pkg/linux/tmp
43
+ cd $ROOT_DIR/pkg/linux/tmp
44
+
42
45
  if [ $ID == 'ubuntu' -o $ID == 'debian' ]; then
43
- curl -L -O ${CPP_CLIENT_BASE_URL}/deb-${PLATFORM}/apache-pulsar-client.deb
44
46
  curl -L -O ${CPP_CLIENT_BASE_URL}/deb-${PLATFORM}/apache-pulsar-client-dev.deb
45
- $SUDO apt install -y /tmp/*.deb
47
+ $SUDO ar x apache-pulsar-client-dev.deb
48
+ $SUDO tar -xvf data.tar.xz
49
+ cp -r usr/* $ROOT_DIR/pkg/linux/pulsar-cpp/
46
50
 
47
51
  elif [ $ID == 'alpine' ]; then
48
- curl -L -O ${CPP_CLIENT_BASE_URL}/apk-${PLATFORM}/${UNAME_ARCH}/apache-pulsar-client-${CPP_CLIENT_VERSION}-r0.apk
49
52
  curl -L -O ${CPP_CLIENT_BASE_URL}/apk-${PLATFORM}/${UNAME_ARCH}/apache-pulsar-client-dev-${CPP_CLIENT_VERSION}-r0.apk
50
- $SUDO apk add --allow-untrusted /tmp/*.apk
53
+ $SUDO tar -xvf apache-pulsar-client-dev-${CPP_CLIENT_VERSION}-r0.apk
54
+ cp -r usr/* $ROOT_DIR/pkg/linux/pulsar-cpp/
51
55
 
52
- elif [ $ID == '"centos"' ]; then
53
- curl -L -O ${CPP_CLIENT_BASE_URL}/rpm-${PLATFORM}/${UNAME_ARCH}/apache-pulsar-client-${CPP_CLIENT_VERSION}-1.${UNAME_ARCH}.rpm
56
+ elif [ $ID == '"centos"' -o $ID == '"rocky"' ]; then
54
57
  curl -L -O ${CPP_CLIENT_BASE_URL}/rpm-${PLATFORM}/${UNAME_ARCH}/apache-pulsar-client-devel-${CPP_CLIENT_VERSION}-1.${UNAME_ARCH}.rpm
55
- $SUDO rpm -i /tmp/*.rpm
58
+ $SUDO rpm -i --prefix=$ROOT_DIR/pkg/linux/pulsar-cpp apache-pulsar-client-devel-${CPP_CLIENT_VERSION}-1.${UNAME_ARCH}.rpm --nodeps --force
56
59
 
57
60
  else
58
61
  echo "Unknown Linux distribution: '$ID'"
59
62
  exit 1
60
63
  fi
61
64
 
62
- mkdir -p $ROOT_DIR/pkg/lib/
63
- cp /usr/lib/libpulsarwithdeps.a $ROOT_DIR/pkg/lib/
64
-
65
-
66
-
65
+ $SUDO rm -rf $ROOT_DIR/pkg/linux/tmp
package/pkg/load_test.js CHANGED
@@ -20,6 +20,10 @@
20
20
  const Pulsar = require('../index.js');
21
21
 
22
22
  (async () => {
23
+ Pulsar.Client.setLogHandler((level, file, line, message) => {
24
+ console.log('[%s][%s:%d] %s', Pulsar.LogLevel.toString(level), file, line, message);
25
+ });
26
+
23
27
  // Create a client
24
28
  const clientConfig = {
25
29
  serviceUrl: 'pulsar://localhost:6650',
@@ -43,9 +43,6 @@ pushd apache-pulsar-client-cpp-${CPP_CLIENT_VERSION}
43
43
  -DBUILD_DYNAMIC_LIB=OFF \
44
44
  -DPROTOC_PATH=$PREFIX/bin/protoc
45
45
  make -j16 install
46
- mkdir -p $ROOT_DIR/pkg/lib/
47
- cp -r lib/libpulsarwithdeps.a $ROOT_DIR/pkg/lib/
48
46
  popd
49
47
 
50
48
  rm -rf apache-pulsar-client-cpp-${CPP_CLIENT_VERSION}.tar.gz apache-pulsar-client-cpp-${CPP_CLIENT_VERSION}
51
-
@@ -1,2 +1,2 @@
1
- CPP_CLIENT_BASE_URL=https://archive.apache.org/dist/pulsar/pulsar-client-cpp-3.1.0/
2
- CPP_CLIENT_VERSION=3.1.0
1
+ CPP_CLIENT_BASE_URL=https://archive.apache.org/dist/pulsar/pulsar-client-cpp-3.1.2
2
+ CPP_CLIENT_VERSION=3.1.2
@@ -0,0 +1,35 @@
1
+ #!/bin/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
+ # NOTE: This script should only run inside a Node.js docker container.
22
+ # See ./load-test.sh for details.
23
+ set -ex
24
+
25
+ # Create an empty directory to test
26
+ mkdir -p /app && cd /app
27
+ tar zxf /pulsar-client-node/pulsar-client-node.tar.gz
28
+
29
+ # Use the existing Pulsar.node built in a specific container
30
+ mkdir -p lib/binding
31
+ cp /pulsar-client-node/build/Release/pulsar.node lib/binding/
32
+ npm install
33
+
34
+ # Test if Pulsar.node can be loaded
35
+ node pkg/load_test.js
@@ -0,0 +1,43 @@
1
+ #!/bin/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
+ # Test if the Pulsar.node built from ../pkg/linux/build-napi-inside-docker.sh
22
+ # can be loaded in other Linux distributions.
23
+
24
+ set -e
25
+
26
+ if [[ $# -lt 2 ]]; then
27
+ echo "Usage $0 <node-image-name> <platform>
28
+
29
+ See https://hub.docker.com/_/node for valid images"
30
+ exit 1
31
+ fi
32
+ IMAGE=$1
33
+ PLATFORM=$2
34
+
35
+ ROOT_DIR=${ROOT_DIR:-$(git rev-parse --show-toplevel)}
36
+ cd $ROOT_DIR
37
+
38
+ git archive -o pulsar-client-node.tar.gz HEAD
39
+
40
+ docker run --platform $PLATFORM -v $PWD:/pulsar-client-node $IMAGE \
41
+ /bin/bash /pulsar-client-node/tests/docker-load-test.sh
42
+
43
+ rm pulsar-client-node.tar.gz
@@ -23,8 +23,8 @@ set -e
23
23
  ROOT_DIR=${ROOT_DIR:-$(git rev-parse --show-toplevel)}
24
24
  cd $ROOT_DIR
25
25
 
26
- # install pulsar cpp client pkg
27
- build-support/install-cpp-client.sh
26
+ # download pulsar cpp client
27
+ pkg/linux/download-cpp-client.sh
28
28
 
29
29
  cd $ROOT_DIR
30
30
  build-support/pulsar-test-service-start.sh