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
package/.asf.yaml CHANGED
@@ -43,4 +43,11 @@ github:
43
43
  # disable merge button:
44
44
  merge: false
45
45
  # disable rebase button:
46
- rebase: false
46
+ rebase: false
47
+
48
+ notifications:
49
+ commits: commits@pulsar.apache.org
50
+ issues: commits@pulsar.apache.org
51
+ pullrequests: commits@pulsar.apache.org
52
+ discussions: dev@pulsar.apache.org
53
+ jira_options: link label
@@ -0,0 +1,85 @@
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
+ <!--
22
+ ### Contribution Checklist
23
+
24
+ - PR title format should be *[type][component] summary*. For details, see *[Guideline - Pulsar PR Naming Convention](https://docs.google.com/document/d/1d8Pw6ZbWk-_pCKdOmdvx9rnhPiyuxwq60_TrD68d7BA/edit#heading=h.trs9rsex3xom)*.
25
+
26
+ - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
27
+
28
+ - Each pull request should address only one issue, not mix up code from multiple issues.
29
+
30
+ - Each commit in the pull request has a meaningful commit message
31
+
32
+ - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
33
+ -->
34
+
35
+ <!-- Either this PR fixes an issue, -->
36
+
37
+ Fixes #<xyz>
38
+
39
+ <!-- or this PR is one task of an issue -->
40
+
41
+ Master Issue: #<xyz>
42
+
43
+ ### Motivation
44
+
45
+ <!-- Explain here the context, and why you're making that change. What is the problem you're trying to solve. -->
46
+
47
+ ### Modifications
48
+
49
+ <!-- Describe the modifications you've done. -->
50
+
51
+ ### Verifying this change
52
+
53
+ - [ ] Make sure that the change passes the CI checks.
54
+
55
+ *(Please pick either of the following options)*
56
+
57
+ This change is a trivial rework / code cleanup without any test coverage.
58
+
59
+ *(or)*
60
+
61
+ This change is already covered by existing tests, such as *(please describe tests)*.
62
+
63
+ *(or)*
64
+
65
+ This change added tests and can be verified as follows:
66
+
67
+ *(example:)*
68
+ - *Added integration tests for end-to-end deployment with large payloads (10MB)*
69
+ - *Extended integration test for recovery after broker failure*
70
+
71
+ ### Documentation
72
+
73
+ <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
74
+
75
+ - [ ] `doc-required`
76
+ (Your PR needs to update docs and you will update later)
77
+
78
+ - [ ] `doc-not-needed`
79
+ (Please explain why)
80
+
81
+ - [ ] `doc`
82
+ (Your PR contains doc changes)
83
+
84
+ - [ ] `doc-complete`
85
+ (Docs have been already added)
@@ -0,0 +1,213 @@
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
+ name: Build release napi
20
+ on:
21
+ workflow_dispatch:
22
+ push:
23
+ tags:
24
+ - '*'
25
+ env:
26
+ FORCE_COLOR: 1
27
+ concurrency:
28
+ group: ${{ github.head_ref || github.run_id }}
29
+ cancel-in-progress: true
30
+ jobs:
31
+ macos-napi:
32
+ name: Build NAPI macos - Node ${{matrix.nodejs}} - ${{matrix.arch}}
33
+ runs-on: macos-latest
34
+ timeout-minutes: 3000
35
+
36
+ strategy:
37
+ fail-fast: false
38
+ matrix:
39
+ arch:
40
+ - x64
41
+ - arm64
42
+ nodejs:
43
+ - 18
44
+ steps:
45
+ - uses: actions/checkout@v3
46
+ - name: Use Node.js ${{ matrix.nodejs }}
47
+ uses: actions/setup-node@v3
48
+ with:
49
+ node-version: ${{ matrix.nodejs }}
50
+ cache: 'npm'
51
+
52
+ - name: Cache Dependencies
53
+ id: cache-dependencies
54
+ uses: actions/cache@v3
55
+ with:
56
+ path: pkg/mac/build
57
+ key: ${{ runner.os }}-${{ matrix.arch }}-mac-${{ hashFiles('pkg/mac/build-cpp-deps-lib.sh') }}
58
+
59
+ - name: Add arch env vars
60
+ run: |
61
+ if [ "${{ matrix.arch }}" = "x64" ]; then
62
+ echo "ARCH=x86_64" >> $GITHUB_ENV
63
+ else
64
+ echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV
65
+ fi
66
+
67
+ - name: Build CPP dependencies lib
68
+ if: steps.cache-dependencies.outputs.cache-hit != 'true'
69
+ run: |
70
+ export ARCH=${{ env.ARCH }}
71
+ pkg/mac/build-cpp-deps-lib.sh
72
+
73
+ - name: Build CPP lib
74
+ if: steps.cache-pulsar.outputs.cache-hit != 'true'
75
+ run: |
76
+ export ARCH=${{ env.ARCH }}
77
+ pkg/mac/build-cpp-lib.sh
78
+
79
+ - name: Build Node binaries lib
80
+ run: |
81
+ npm install --ignore-scripts
82
+ npx node-pre-gyp configure --target_arch=${{ matrix.arch }}
83
+ npx node-pre-gyp build --target_arch=${{ matrix.arch }}
84
+
85
+ - name: Test loading Node binaries lib
86
+ if: matrix.arch == 'x64'
87
+ run: |
88
+ node pkg/load_test.js
89
+
90
+ - name: Package Node binaries lib
91
+ run: |
92
+ npx node-pre-gyp package --target_arch=${{ matrix.arch }}
93
+
94
+ - name: Upload artifacts
95
+ uses: actions/upload-artifact@v3
96
+ with:
97
+ name: macos-${{matrix.nodejs}}-${{matrix.arch}}
98
+ path: build/stage/*/*.tar.gz
99
+
100
+ linux-napi:
101
+ name: Build NAPI ${{matrix.image}} - Node ${{matrix.nodejs}} - ${{matrix.cpu.platform}}
102
+ runs-on: ubuntu-22.04
103
+ timeout-minutes: 3000
104
+
105
+ strategy:
106
+ fail-fast: false
107
+ matrix:
108
+ image:
109
+ - 'linux_glibc'
110
+ - 'linux_musl'
111
+ nodejs:
112
+ - 18
113
+ cpu:
114
+ - {arch: 'x86_64', platform: 'x86_64'}
115
+ - {arch: 'aarch64', platform: 'arm64'}
116
+
117
+ steps:
118
+ - name: checkout
119
+ uses: actions/checkout@v3
120
+
121
+ - name: Set up QEMU
122
+ uses: docker/setup-qemu-action@v2
123
+
124
+ - name: Setup Docker Buildx
125
+ uses: docker/setup-buildx-action@v2
126
+
127
+ - name: Build Linux Docker image
128
+ uses: docker/build-push-action@v3
129
+ with:
130
+ file: ./pkg/linux/Dockerfile_${{matrix.image}}
131
+ load: true
132
+ tags: build:latest
133
+ platforms: linux/${{matrix.cpu.arch}}
134
+ build-args: |
135
+ PLATFORM=${{matrix.cpu.platform}}
136
+ ARCH=${{matrix.cpu.arch}}
137
+ NODE_VERSION=${{matrix.nodejs}}
138
+ cache-from: type=gha
139
+ cache-to: type=gha,mode=max
140
+
141
+ - name: Build and Test NAPI file
142
+ run: |
143
+ docker run -i -v $PWD:/pulsar-client-node build:latest \
144
+ /pulsar-client-node/pkg/linux/build-napi-inside-docker.sh
145
+
146
+ - name: Upload artifacts
147
+ uses: actions/upload-artifact@v3
148
+ with:
149
+ name: ${{matrix.image}}-${{matrix.nodejs}}-${{matrix.cpu.platform}}
150
+ path: build/stage/*/*.tar.gz
151
+
152
+ windows-napi:
153
+ name: Build NAPI windows - Node ${{matrix.nodejs}} - ${{matrix.arch}}
154
+ runs-on: windows-2022
155
+ timeout-minutes: 3000
156
+
157
+ strategy:
158
+ fail-fast: false
159
+ matrix:
160
+ arch:
161
+ - x64
162
+ - x86
163
+ nodejs:
164
+ - 18
165
+ steps:
166
+ - uses: actions/checkout@v3
167
+ - name: Use Node.js ${{ matrix.nodejs }}
168
+ uses: actions/setup-node@v3
169
+ with:
170
+ node-version: ${{ matrix.nodejs }}
171
+ architecture: ${{ matrix.arch }}
172
+ cache: 'npm'
173
+
174
+ - name: Cache CPP Client
175
+ id: cache-dependencies
176
+ uses: actions/cache@v3
177
+ with:
178
+ path: pkg/windows/
179
+ key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('pulsar-client-cpp.txt') }}
180
+
181
+ - name: Add env vars
182
+ shell: bash
183
+ run: |
184
+ if [ "${{ matrix.arch }}" = "x86" ]; then
185
+ echo "TARGET=ia32" >> $GITHUB_ENV
186
+ else
187
+ echo "TARGET=${{ matrix.arch }}" >> $GITHUB_ENV
188
+ fi
189
+
190
+ - name: Download CPP Client
191
+ if: steps.cache-dependencies.outputs.cache-hit != 'true'
192
+ run: |
193
+ pkg/windows/download-cpp-client.bat ${{ matrix.arch }}
194
+
195
+ - name: Build Node binaries lib
196
+ run: |
197
+ npm install --ignore-scripts
198
+ npx node-pre-gyp configure --target_arch=${{ env.TARGET }}
199
+ npx node-pre-gyp build --target_arch=${{ env.TARGET }}
200
+
201
+ - name: Test loading Node binaries lib
202
+ run: |
203
+ node pkg/load_test.js
204
+
205
+ - name: Package Node binaries lib
206
+ run: |
207
+ npx node-pre-gyp package --target_arch=${{ env.TARGET }}
208
+
209
+ - name: Upload artifacts
210
+ uses: actions/upload-artifact@v3
211
+ with:
212
+ name: windows-${{matrix.nodejs}}-${{matrix.arch}}
213
+ path: build/stage/*/*.tar.gz
@@ -0,0 +1,233 @@
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
+ name: PR validation
20
+ on:
21
+ pull_request:
22
+ branches: ['master']
23
+
24
+ concurrency:
25
+ group: ${{ github.workflow }}-${{ github.ref }}
26
+ cancel-in-progress: true
27
+
28
+ jobs:
29
+ unit-tests:
30
+ name: Run unit tests
31
+ runs-on: ubuntu-22.04
32
+ timeout-minutes: 120
33
+
34
+ steps:
35
+ - uses: actions/checkout@v3
36
+ - name: Use Node.js 18
37
+ uses: actions/setup-node@v3
38
+ with:
39
+ node-version: 18
40
+
41
+ - name: Run Test
42
+ run: |
43
+ ./tests/run-unit-tests.sh
44
+
45
+ validation-yarn:
46
+ name: Validation use yarn install
47
+ runs-on: ubuntu-22.04
48
+ timeout-minutes: 120
49
+
50
+ steps:
51
+ - uses: actions/checkout@v3
52
+ - name: Use Node.js 18
53
+ uses: actions/setup-node@v3
54
+ with:
55
+ node-version: 18
56
+
57
+ - name: Use yarn install
58
+ run: |
59
+ yarn install --ignore-scripts
60
+
61
+ macos-napi:
62
+ name: Build NAPI macos - Node ${{matrix.nodejs}} - ${{matrix.arch}}
63
+ runs-on: macos-latest
64
+ timeout-minutes: 3000
65
+
66
+ strategy:
67
+ fail-fast: false
68
+ matrix:
69
+ arch:
70
+ - x64
71
+ - arm64
72
+ nodejs:
73
+ - 18
74
+ steps:
75
+ - uses: actions/checkout@v3
76
+ - name: Use Node.js ${{ matrix.nodejs }}
77
+ uses: actions/setup-node@v3
78
+ with:
79
+ node-version: ${{ matrix.nodejs }}
80
+ cache: 'npm'
81
+
82
+ - name: Cache Dependencies
83
+ id: cache-dependencies
84
+ uses: actions/cache@v3
85
+ with:
86
+ path: pkg/mac/build
87
+ key: ${{ runner.os }}-${{ matrix.arch }}-mac-${{ hashFiles('pkg/mac/build-cpp-deps-lib.sh') }}
88
+
89
+ - name: Add arch env vars
90
+ run: |
91
+ if [ "${{ matrix.arch }}" = "x64" ]; then
92
+ echo "ARCH=x86_64" >> $GITHUB_ENV
93
+ else
94
+ echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV
95
+ fi
96
+
97
+ - name: Build CPP dependencies lib
98
+ if: steps.cache-dependencies.outputs.cache-hit != 'true'
99
+ run: |
100
+ export ARCH=${{ env.ARCH }}
101
+ pkg/mac/build-cpp-deps-lib.sh
102
+
103
+ - name: Build CPP lib
104
+ if: steps.cache-pulsar.outputs.cache-hit != 'true'
105
+ run: |
106
+ export ARCH=${{ env.ARCH }}
107
+ pkg/mac/build-cpp-lib.sh
108
+
109
+ - name: Build Node binaries lib
110
+ run: |
111
+ npm install --ignore-scripts
112
+ npx node-pre-gyp configure --target_arch=${{ matrix.arch }}
113
+ npx node-pre-gyp build --target_arch=${{ matrix.arch }}
114
+
115
+ - name: Test loading Node binaries lib
116
+ if: matrix.arch == 'x64'
117
+ run: |
118
+ node pkg/load_test.js
119
+
120
+ - name: Package Node binaries lib
121
+ run: |
122
+ npx node-pre-gyp package --target_arch=${{ matrix.arch }}
123
+
124
+ linux-napi:
125
+ name: Build NAPI ${{matrix.image}} - Node ${{matrix.nodejs}} - ${{matrix.cpu.platform}}
126
+ runs-on: ubuntu-22.04
127
+ timeout-minutes: 3000
128
+
129
+ strategy:
130
+ fail-fast: false
131
+ matrix:
132
+ image:
133
+ - 'linux_glibc'
134
+ - 'linux_musl'
135
+ nodejs:
136
+ - 18
137
+ cpu:
138
+ - {arch: 'x86_64', platform: 'x86_64'}
139
+ - {arch: 'aarch64', platform: 'arm64'}
140
+
141
+ steps:
142
+ - name: checkout
143
+ uses: actions/checkout@v3
144
+
145
+ - name: Set up QEMU
146
+ uses: docker/setup-qemu-action@v2
147
+
148
+ - name: Setup Docker Buildx
149
+ uses: docker/setup-buildx-action@v2
150
+
151
+ - name: Build Linux Docker image
152
+ uses: docker/build-push-action@v3
153
+ with:
154
+ file: ./pkg/linux/Dockerfile_${{matrix.image}}
155
+ load: true
156
+ tags: build:latest
157
+ platforms: linux/${{matrix.cpu.arch}}
158
+ build-args: |
159
+ PLATFORM=${{matrix.cpu.platform}}
160
+ ARCH=${{matrix.cpu.arch}}
161
+ NODE_VERSION=${{matrix.nodejs}}
162
+ cache-from: type=gha
163
+ cache-to: type=gha,mode=max
164
+
165
+ - name: Build and Test NAPI file
166
+ run: |
167
+ docker run -i -v $PWD:/pulsar-client-node build:latest \
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}}
177
+
178
+ windows-napi:
179
+ name: Build NAPI windows - Node ${{matrix.nodejs}} - ${{matrix.arch}}
180
+ runs-on: windows-2022
181
+ timeout-minutes: 3000
182
+
183
+ strategy:
184
+ fail-fast: false
185
+ matrix:
186
+ arch:
187
+ - x64
188
+ - x86
189
+ nodejs:
190
+ - 18
191
+ steps:
192
+ - uses: actions/checkout@v3
193
+ - name: Use Node.js ${{ matrix.nodejs }}
194
+ uses: actions/setup-node@v3
195
+ with:
196
+ node-version: ${{ matrix.nodejs }}
197
+ architecture: ${{ matrix.arch }}
198
+ cache: 'npm'
199
+
200
+ - name: Cache CPP Client
201
+ id: cache-dependencies
202
+ uses: actions/cache@v3
203
+ with:
204
+ path: pkg/windows/
205
+ key: ${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('pulsar-client-cpp.txt') }}
206
+
207
+ - name: Add env vars
208
+ shell: bash
209
+ run: |
210
+ if [ "${{ matrix.arch }}" = "x86" ]; then
211
+ echo "TARGET=ia32" >> $GITHUB_ENV
212
+ else
213
+ echo "TARGET=${{ matrix.arch }}" >> $GITHUB_ENV
214
+ fi
215
+
216
+ - name: Download CPP Client
217
+ if: steps.cache-dependencies.outputs.cache-hit != 'true'
218
+ run: |
219
+ pkg/windows/download-cpp-client.bat ${{ matrix.arch }}
220
+
221
+ - name: Build Node binaries lib
222
+ run: |
223
+ npm install --ignore-scripts
224
+ npx node-pre-gyp configure --target_arch=${{ env.TARGET }}
225
+ npx node-pre-gyp build --target_arch=${{ env.TARGET }}
226
+
227
+ - name: Test loading Node binaries lib
228
+ run: |
229
+ node pkg/load_test.js
230
+
231
+ - name: Package Node binaries lib
232
+ run: |
233
+ npx node-pre-gyp package --target_arch=${{ env.TARGET }}