pulsar-client 1.13.2 → 1.14.0-rc.2

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 (68) hide show
  1. package/index.d.ts +17 -0
  2. package/package.json +1 -1
  3. package/pulsar-client-1.14.0-rc.1.tgz +0 -0
  4. package/src/Client.cc +2 -1
  5. package/src/Client.h +1 -0
  6. package/src/ConsumerConfig.cc +66 -0
  7. package/.clang-format +0 -26
  8. package/.eslintignore +0 -21
  9. package/.eslintrc.json +0 -22
  10. package/.github/PULL_REQUEST_TEMPLATE.md +0 -85
  11. package/.github/workflows/ci-build-release-napi.yml +0 -211
  12. package/.github/workflows/ci-pr-validation.yml +0 -334
  13. package/build-support/download-release-artifacts.py +0 -77
  14. package/build-support/generate-source-archive.sh +0 -28
  15. package/build-support/pulsar-test-container-start.sh +0 -43
  16. package/build-support/pulsar-test-service-start.sh +0 -39
  17. package/build-support/pulsar-test-service-stop.sh +0 -32
  18. package/build-support/sign-files.sh +0 -32
  19. package/build-support/stage-release.sh +0 -44
  20. package/docs/release-process.md +0 -291
  21. package/examples/certificate/private-key.client-rsa.pem +0 -27
  22. package/examples/certificate/public-key.client-rsa.pem +0 -9
  23. package/examples/consumer-schema.js +0 -66
  24. package/examples/consumer.js +0 -46
  25. package/examples/consumer_listener.js +0 -44
  26. package/examples/consumer_tls_auth.js +0 -51
  27. package/examples/consummer_token_auth.js +0 -50
  28. package/examples/consummer_token_auth_supplier.js +0 -56
  29. package/examples/custom_logger.js +0 -60
  30. package/examples/encryption-consumer.js +0 -47
  31. package/examples/encryption-producer.js +0 -50
  32. package/examples/encryption-reader.js +0 -44
  33. package/examples/producer-schema.js +0 -76
  34. package/examples/producer.js +0 -48
  35. package/examples/producer_tls_auth.js +0 -52
  36. package/examples/producer_token_auth.js +0 -48
  37. package/examples/producer_token_auth_supplier.js +0 -53
  38. package/examples/reader.js +0 -43
  39. package/examples/reader_listener.js +0 -37
  40. package/license-checker-config.json +0 -43
  41. package/license-header.txt +0 -16
  42. package/perf/perf_consumer.js +0 -103
  43. package/perf/perf_producer.js +0 -118
  44. package/pkg/linux/Dockerfile_linux_glibc +0 -31
  45. package/pkg/linux/Dockerfile_linux_musl +0 -32
  46. package/pkg/linux/build-napi-inside-docker.sh +0 -31
  47. package/pkg/linux/download-cpp-client.sh +0 -65
  48. package/pkg/load_test.js +0 -34
  49. package/pkg/mac/download-cpp-client.sh +0 -36
  50. package/pkg/windows/download-cpp-client.bat +0 -12
  51. package/tests/certificate/private-key.client-rsa.pem +0 -27
  52. package/tests/certificate/public-key.client-rsa.pem +0 -9
  53. package/tests/certificate/server.crt +0 -20
  54. package/tests/certificate/server.key +0 -28
  55. package/tests/client.test.js +0 -122
  56. package/tests/conf/standalone.conf +0 -308
  57. package/tests/consumer.test.js +0 -434
  58. package/tests/docker-load-test.sh +0 -35
  59. package/tests/end_to_end.test.js +0 -1447
  60. package/tests/http_utils.js +0 -45
  61. package/tests/load-test.sh +0 -43
  62. package/tests/producer.test.js +0 -160
  63. package/tests/reader.test.js +0 -175
  64. package/tests/run-unit-tests.sh +0 -35
  65. package/tsconfig.json +0 -22
  66. package/tslint.json +0 -9
  67. package/tstest.ts +0 -408
  68. package/typedoc.json +0 -15
@@ -1,122 +0,0 @@
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 httpRequest = require('./http_utils');
21
- const Pulsar = require('../index');
22
-
23
- const baseUrl = 'http://localhost:8080';
24
-
25
- (() => {
26
- describe('Client', () => {
27
- describe('CreateFailedByUrlSetIncorrect', () => {
28
- test('No Set Url', async () => {
29
- await expect(() => new Pulsar.Client({
30
- operationTimeoutSeconds: 30,
31
- })).toThrow('Service URL is required and must be specified as a string');
32
- });
33
-
34
- test('Set empty url', async () => {
35
- await expect(() => new Pulsar.Client({
36
- serviceUrl: '',
37
- operationTimeoutSeconds: 30,
38
- })).toThrow('Service URL is required and must be specified as a string');
39
- });
40
-
41
- test('Set invalid url', async () => {
42
- await expect(() => new Pulsar.Client({
43
- serviceUrl: 'invalid://localhost:6655',
44
- operationTimeoutSeconds: 30,
45
- })).toThrow('Invalid scheme: invalid');
46
- });
47
-
48
- test('Set not string url', async () => {
49
- await expect(() => new Pulsar.Client({
50
- serviceUrl: -1,
51
- operationTimeoutSeconds: 30,
52
- })).toThrow('Service URL is required and must be specified as a string');
53
- });
54
- });
55
- describe('test getPartitionsForTopic', () => {
56
- test('GetPartitions for empty topic', async () => {
57
- const client = new Pulsar.Client({
58
- serviceUrl: 'pulsar://localhost:6650',
59
- operationTimeoutSeconds: 30,
60
- });
61
-
62
- await expect(client.getPartitionsForTopic(''))
63
- .rejects.toThrow('Failed to GetPartitionsForTopic: InvalidTopicName');
64
- await client.close();
65
- });
66
-
67
- test('Client/getPartitionsForTopic', async () => {
68
- const client = new Pulsar.Client({
69
- serviceUrl: 'pulsar://localhost:6650',
70
- operationTimeoutSeconds: 30,
71
- });
72
-
73
- // test on nonPartitionedTopic
74
- const nonPartitionedTopicName = 'test-non-partitioned-topic';
75
- const nonPartitionedTopic = `persistent://public/default/${nonPartitionedTopicName}`;
76
- const nonPartitionedTopicAdminURL = `${baseUrl}/admin/v2/persistent/public/default/${nonPartitionedTopicName}`;
77
- const createNonPartitionedTopicRes = await httpRequest(
78
- nonPartitionedTopicAdminURL, {
79
- headers: {
80
- 'Content-Type': 'application/json',
81
- },
82
- method: 'PUT',
83
- },
84
- );
85
- expect(createNonPartitionedTopicRes.statusCode).toBe(204);
86
-
87
- const nonPartitionedTopicList = await client.getPartitionsForTopic(nonPartitionedTopic);
88
- expect(nonPartitionedTopicList).toEqual([nonPartitionedTopic]);
89
-
90
- // test on partitioned with number
91
- const partitionedTopicName = 'test-partitioned-topic-1';
92
- const partitionedTopic = `persistent://public/default/${partitionedTopicName}`;
93
- const partitionedTopicAdminURL = `${baseUrl}/admin/v2/persistent/public/default/${partitionedTopicName}/partitions`;
94
- const createPartitionedTopicRes = await httpRequest(
95
- partitionedTopicAdminURL, {
96
- headers: {
97
- 'Content-Type': 'text/plain',
98
- },
99
- data: 4,
100
- method: 'PUT',
101
- },
102
- );
103
- expect(createPartitionedTopicRes.statusCode).toBe(204);
104
-
105
- const partitionedTopicList = await client.getPartitionsForTopic(partitionedTopic);
106
- expect(partitionedTopicList).toEqual([
107
- 'persistent://public/default/test-partitioned-topic-1-partition-0',
108
- 'persistent://public/default/test-partitioned-topic-1-partition-1',
109
- 'persistent://public/default/test-partitioned-topic-1-partition-2',
110
- 'persistent://public/default/test-partitioned-topic-1-partition-3',
111
- ]);
112
-
113
- const deleteNonPartitionedTopicRes = await httpRequest(nonPartitionedTopicAdminURL, { method: 'DELETE' });
114
- expect(deleteNonPartitionedTopicRes.statusCode).toBe(204);
115
- const deletePartitionedTopicRes = await httpRequest(partitionedTopicAdminURL, { method: 'DELETE' });
116
- expect(deletePartitionedTopicRes.statusCode).toBe(204);
117
-
118
- await client.close();
119
- });
120
- });
121
- });
122
- })();
@@ -1,308 +0,0 @@
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
- ### --- General broker settings --- ###
21
-
22
- # Zookeeper quorum connection string
23
- zookeeperServers=
24
-
25
- # Global Zookeeper quorum connection string
26
- globalZookeeperServers=
27
-
28
- brokerServicePort=6650
29
- brokerServicePortTls=6651
30
-
31
- # Port to use to server HTTP request
32
- webServicePort=8080
33
- webServicePortTls=8443
34
-
35
- # Hostname or IP address the service binds on, default is 0.0.0.0.
36
- bindAddress=0.0.0.0
37
-
38
- # Hostname or IP address the service advertises to the outside world. If not set, the value of InetAddress.getLocalHost().getHostName() is used.
39
- advertisedAddress=localhost
40
-
41
- # Used to specify multiple advertised listeners for the broker.
42
- # The value must format as <listener_name>:pulsar://<host>:<port>,
43
- # multiple listeners should separate with commas.
44
- # Do not use this configuration with advertisedAddress and brokerServicePort.
45
- # The Default value is absent means use advertisedAddress and brokerServicePort.
46
- advertisedListeners=localhost6650:pulsar://localhost:6650,localhost6651:pulsar+ssl://localhost:6651,localhost8443:pulsar+ssl://localhost:8443
47
-
48
- # Name of the cluster to which this broker belongs to
49
- clusterName=standalone
50
-
51
- # Zookeeper session timeout in milliseconds
52
- zooKeeperSessionTimeoutMillis=30000
53
-
54
- # Time to wait for broker graceful shutdown. After this time elapses, the process will be killed
55
- brokerShutdownTimeoutMs=3000
56
-
57
- # Enable backlog quota check. Enforces action on topic when the quota is reached
58
- backlogQuotaCheckEnabled=true
59
-
60
- # How often to check for topics that have reached the quota
61
- backlogQuotaCheckIntervalInSeconds=60
62
-
63
- # Default per-topic backlog quota limit
64
- backlogQuotaDefaultLimitGB=10
65
-
66
- # Enable the deletion of inactive topics
67
- brokerDeleteInactiveTopicsEnabled=true
68
-
69
- # Enable batch index ACK
70
- acknowledgmentAtBatchIndexLevelEnabled=true
71
-
72
- # How often to check for inactive topics
73
- brokerDeleteInactiveTopicsFrequencySeconds=60
74
-
75
- # How frequently to proactively check and purge expired messages
76
- messageExpiryCheckIntervalInMinutes=5
77
-
78
- # Enable check for minimum allowed client library version
79
- clientLibraryVersionCheckEnabled=false
80
-
81
- # Allow client libraries with no version information
82
- clientLibraryVersionCheckAllowUnversioned=true
83
-
84
- # Path for the file used to determine the rotation status for the broker when responding
85
- # to service discovery health checks
86
- statusFilePath=/usr/local/apache/htdocs
87
-
88
- # Max number of unacknowledged messages allowed to receive messages by a consumer on a shared subscription. Broker will stop sending
89
- # messages to consumer once, this limit reaches until consumer starts acknowledging messages back
90
- # Using a value of 0, is disabling unackeMessage limit check and consumer can receive messages without any restriction
91
- maxUnackedMessagesPerConsumer=50000
92
-
93
- subscriptionRedeliveryTrackerEnabled=true
94
-
95
- # Whether to enable the delayed delivery for messages.
96
- # If disabled, messages will be immediately delivered and there will
97
- # be no tracking overhead.
98
- delayedDeliveryEnabled=true
99
-
100
- # Control the tick time for when retrying on delayed delivery,
101
- # affecting the accuracy of the delivery time compared to the scheduled time.
102
- # Default is 1 second.
103
- delayedDeliveryTickTimeMillis=1000
104
-
105
- ### --- TLS --- ###
106
- # Path for the TLS certificate file
107
- tlsCertificateFilePath=/pulsar/test-conf/server.crt
108
-
109
- # Path for the TLS private key file
110
- tlsKeyFilePath=/pulsar/test-conf/server.key
111
-
112
- # Path for the trusted TLS certificate file.
113
- # This cert is used to verify that any certs presented by connecting clients
114
- # are signed by a certificate authority. If this verification
115
- # fails, then the certs are untrusted and the connections are dropped.
116
- tlsTrustCertsFilePath=/pulsar/test-conf/server.crt
117
-
118
- ### --- Authentication --- ###
119
-
120
- # Enable authentication
121
- authenticationEnabled=false
122
-
123
- # Autentication provider name list, which is comma separated list of class names
124
- authenticationProviders=false
125
-
126
- # Enforce authorization
127
- authorizationEnabled=false
128
-
129
- # Role names that are treated as "super-user", meaning they will be able to do all admin
130
- # operations and publish/consume from all topics
131
- superUserRoles=
132
-
133
- # Authentication settings of the broker itself. Used when the broker connects to other brokers,
134
- # either in same or other clusters
135
- brokerClientAuthenticationPlugin=
136
- brokerClientAuthenticationParameters=
137
-
138
-
139
- ### --- BookKeeper Client --- ###
140
-
141
- # Authentication plugin to use when connecting to bookies
142
- bookkeeperClientAuthenticationPlugin=
143
-
144
- # BookKeeper auth plugin implementatation specifics parameters name and values
145
- bookkeeperClientAuthenticationParametersName=
146
- bookkeeperClientAuthenticationParameters=
147
-
148
- # Timeout for BK add / read operations
149
- bookkeeperClientTimeoutInSeconds=30
150
-
151
- # Speculative reads are initiated if a read request doesn't complete within a certain time
152
- # Using a value of 0, is disabling the speculative reads
153
- bookkeeperClientSpeculativeReadTimeoutInMillis=0
154
-
155
- # Enable bookies health check. Bookies that have more than the configured number of failure within
156
- # the interval will be quarantined for some time. During this period, new ledgers won't be created
157
- # on these bookies
158
- bookkeeperClientHealthCheckEnabled=true
159
- bookkeeperClientHealthCheckIntervalSeconds=60
160
- bookkeeperClientHealthCheckErrorThresholdPerInterval=5
161
- bookkeeperClientHealthCheckQuarantineTimeInSeconds=1800
162
-
163
- # Enable rack-aware bookie selection policy. BK will chose bookies from different racks when
164
- # forming a new bookie ensemble
165
- bookkeeperClientRackawarePolicyEnabled=true
166
-
167
- # Enable region-aware bookie selection policy. BK will chose bookies from
168
- # different regions and racks when forming a new bookie ensemble
169
- # If enabled, the value of bookkeeperClientRackawarePolicyEnabled is ignored
170
- bookkeeperClientRegionawarePolicyEnabled=false
171
-
172
- # Enable/disable reordering read sequence on reading entries.
173
- bookkeeperClientReorderReadSequenceEnabled=false
174
-
175
- # Enable bookie isolation by specifying a list of bookie groups to choose from. Any bookie
176
- # outside the specified groups will not be used by the broker
177
- bookkeeperClientIsolationGroups=
178
-
179
- ### --- Managed Ledger --- ###
180
-
181
- # Number of bookies to use when creating a ledger
182
- managedLedgerDefaultEnsembleSize=1
183
-
184
- # Number of copies to store for each message
185
- managedLedgerDefaultWriteQuorum=1
186
-
187
- # Number of guaranteed copies (acks to wait before write is complete)
188
- managedLedgerDefaultAckQuorum=1
189
-
190
- # Amount of memory to use for caching data payload in managed ledger. This memory
191
- # is allocated from JVM direct memory and it's shared across all the topics
192
- # running in the same broker
193
- managedLedgerCacheSizeMB=1024
194
-
195
- # Threshold to which bring down the cache level when eviction is triggered
196
- managedLedgerCacheEvictionWatermark=0.9
197
-
198
- # Rate limit the amount of writes generated by consumer acking the messages
199
- managedLedgerDefaultMarkDeleteRateLimit=0.1
200
-
201
- # Max number of entries to append to a ledger before triggering a rollover
202
- # A ledger rollover is triggered on these conditions
203
- # * Either the max rollover time has been reached
204
- # * or max entries have been written to the ledged and at least min-time
205
- # has passed
206
- managedLedgerMaxEntriesPerLedger=50000
207
-
208
- # Minimum time between ledger rollover for a topic
209
- managedLedgerMinLedgerRolloverTimeMinutes=10
210
-
211
- # Maximum time before forcing a ledger rollover for a topic
212
- managedLedgerMaxLedgerRolloverTimeMinutes=240
213
-
214
- # Max number of entries to append to a cursor ledger
215
- managedLedgerCursorMaxEntriesPerLedger=50000
216
-
217
- # Max time before triggering a rollover on a cursor ledger
218
- managedLedgerCursorRolloverTimeInSeconds=14400
219
-
220
-
221
-
222
- ### --- Load balancer --- ###
223
-
224
- # Enable load balancer
225
- loadBalancerEnabled=false
226
-
227
- # Strategy to assign a new bundle
228
- loadBalancerPlacementStrategy=weightedRandomSelection
229
-
230
- # Percentage of change to trigger load report update
231
- loadBalancerReportUpdateThresholdPercentage=10
232
-
233
- # maximum interval to update load report
234
- loadBalancerReportUpdateMaxIntervalMinutes=15
235
-
236
- # Frequency of report to collect
237
- loadBalancerHostUsageCheckIntervalMinutes=1
238
-
239
- # Load shedding interval. Broker periodically checks whether some traffic should be offload from
240
- # some over-loaded broker to other under-loaded brokers
241
- loadBalancerSheddingIntervalMinutes=30
242
-
243
- # Prevent the same topics to be shed and moved to other broker more that once within this timeframe
244
- loadBalancerSheddingGracePeriodMinutes=30
245
-
246
- # Usage threshold to determine a broker as under-loaded
247
- loadBalancerBrokerUnderloadedThresholdPercentage=1
248
-
249
- # Usage threshold to determine a broker as over-loaded
250
- loadBalancerBrokerOverloadedThresholdPercentage=85
251
-
252
- # Interval to update namespace bundle resource quotat
253
- loadBalancerResourceQuotaUpdateIntervalMinutes=15
254
-
255
- # Usage threshold to determine a broker is having just right level of load
256
- loadBalancerBrokerComfortLoadLevelPercentage=65
257
-
258
- # enable/disable namespace bundle auto split
259
- loadBalancerAutoBundleSplitEnabled=false
260
-
261
- # interval to detect & split hot namespace bundle
262
- loadBalancerNamespaceBundleSplitIntervalMinutes=15
263
-
264
- # maximum topics in a bundle, otherwise bundle split will be triggered
265
- loadBalancerNamespaceBundleMaxTopics=1000
266
-
267
- # maximum sessions (producers + consumers) in a bundle, otherwise bundle split will be triggered
268
- loadBalancerNamespaceBundleMaxSessions=1000
269
-
270
- # maximum msgRate (in + out) in a bundle, otherwise bundle split will be triggered
271
- loadBalancerNamespaceBundleMaxMsgRate=1000
272
-
273
- # maximum bandwidth (in + out) in a bundle, otherwise bundle split will be triggered
274
- loadBalancerNamespaceBundleMaxBandwidthMbytes=100
275
-
276
- # maximum number of bundles in a namespace
277
- loadBalancerNamespaceMaximumBundles=128
278
-
279
- ### --- Replication --- ###
280
-
281
- # Enable replication metrics
282
- replicationMetricsEnabled=true
283
-
284
- # Max number of connections to open for each broker in a remote cluster
285
- # More connections host-to-host lead to better throughput over high-latency
286
- # links.
287
- replicationConnectionsPerBroker=16
288
-
289
- # Replicator producer queue size
290
- replicationProducerQueueSize=1000
291
-
292
- # Default message retention time
293
- defaultRetentionTimeInMinutes=0
294
-
295
- # Default retention size
296
- defaultRetentionSizeInMB=0
297
-
298
- # How often to check whether the connections are still alive
299
- keepAliveIntervalSeconds=30
300
-
301
- # How often broker checks for inactive topics to be deleted (topics with no subscriptions and no one connected)
302
- brokerServicePurgeInactiveFrequencyInSeconds=60
303
-
304
- ### --- BookKeeper Configuration --- #####
305
-
306
- # The maximum netty frame size in bytes. Any message received larger than this will be rejected. The default value is 5MB.
307
- nettyMaxFrameSizeBytes=5253120
308
-