pulsar-client 1.7.0 → 1.8.0-rc1

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