pulsar-client 1.13.2-rc.1 → 1.14.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 (77) hide show
  1. package/.idea/aws.xml +18 -0
  2. package/.idea/codeStyles/Project.xml +7 -0
  3. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  4. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  5. package/.idea/misc.xml +7 -0
  6. package/.idea/modules.xml +9 -0
  7. package/.idea/pulsar-client-node.iml +46 -0
  8. package/.idea/pulsar_client_node.iml +8 -0
  9. package/.idea/vcs.xml +6 -0
  10. package/index.d.ts +17 -0
  11. package/package.json +1 -1
  12. package/src/Client.cc +2 -1
  13. package/src/Client.h +1 -0
  14. package/src/ConsumerConfig.cc +66 -0
  15. package/src/cert.pem +3278 -0
  16. package/.clang-format +0 -26
  17. package/.eslintignore +0 -21
  18. package/.eslintrc.json +0 -22
  19. package/.github/PULL_REQUEST_TEMPLATE.md +0 -85
  20. package/.github/workflows/ci-build-release-napi.yml +0 -211
  21. package/.github/workflows/ci-pr-validation.yml +0 -334
  22. package/build-support/download-release-artifacts.py +0 -77
  23. package/build-support/generate-source-archive.sh +0 -28
  24. package/build-support/pulsar-test-container-start.sh +0 -43
  25. package/build-support/pulsar-test-service-start.sh +0 -39
  26. package/build-support/pulsar-test-service-stop.sh +0 -32
  27. package/build-support/sign-files.sh +0 -32
  28. package/build-support/stage-release.sh +0 -44
  29. package/docs/release-process.md +0 -291
  30. package/examples/certificate/private-key.client-rsa.pem +0 -27
  31. package/examples/certificate/public-key.client-rsa.pem +0 -9
  32. package/examples/consumer-schema.js +0 -66
  33. package/examples/consumer.js +0 -46
  34. package/examples/consumer_listener.js +0 -44
  35. package/examples/consumer_tls_auth.js +0 -51
  36. package/examples/consummer_token_auth.js +0 -50
  37. package/examples/consummer_token_auth_supplier.js +0 -56
  38. package/examples/custom_logger.js +0 -60
  39. package/examples/encryption-consumer.js +0 -47
  40. package/examples/encryption-producer.js +0 -50
  41. package/examples/encryption-reader.js +0 -44
  42. package/examples/producer-schema.js +0 -76
  43. package/examples/producer.js +0 -48
  44. package/examples/producer_tls_auth.js +0 -52
  45. package/examples/producer_token_auth.js +0 -48
  46. package/examples/producer_token_auth_supplier.js +0 -53
  47. package/examples/reader.js +0 -43
  48. package/examples/reader_listener.js +0 -37
  49. package/license-checker-config.json +0 -43
  50. package/license-header.txt +0 -16
  51. package/perf/perf_consumer.js +0 -103
  52. package/perf/perf_producer.js +0 -118
  53. package/pkg/linux/Dockerfile_linux_glibc +0 -31
  54. package/pkg/linux/Dockerfile_linux_musl +0 -32
  55. package/pkg/linux/build-napi-inside-docker.sh +0 -31
  56. package/pkg/linux/download-cpp-client.sh +0 -65
  57. package/pkg/load_test.js +0 -34
  58. package/pkg/mac/download-cpp-client.sh +0 -36
  59. package/pkg/windows/download-cpp-client.bat +0 -12
  60. package/tests/certificate/private-key.client-rsa.pem +0 -27
  61. package/tests/certificate/public-key.client-rsa.pem +0 -9
  62. package/tests/certificate/server.crt +0 -20
  63. package/tests/certificate/server.key +0 -28
  64. package/tests/client.test.js +0 -122
  65. package/tests/conf/standalone.conf +0 -308
  66. package/tests/consumer.test.js +0 -434
  67. package/tests/docker-load-test.sh +0 -35
  68. package/tests/end_to_end.test.js +0 -1447
  69. package/tests/http_utils.js +0 -45
  70. package/tests/load-test.sh +0 -43
  71. package/tests/producer.test.js +0 -160
  72. package/tests/reader.test.js +0 -175
  73. package/tests/run-unit-tests.sh +0 -35
  74. package/tsconfig.json +0 -22
  75. package/tslint.json +0 -9
  76. package/tstest.ts +0 -408
  77. package/typedoc.json +0 -15
package/tstest.ts DELETED
@@ -1,408 +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
- import Pulsar = require('./index');
20
-
21
- // Maximum parameters
22
- (async () => {
23
- const authTls: Pulsar.AuthenticationTls = new Pulsar.AuthenticationTls({
24
- certificatePath: '/path/to/cert.pem',
25
- privateKeyPath: '/path/to/key.pem',
26
- });
27
-
28
- const authAthenz1: Pulsar.AuthenticationAthenz = new Pulsar.AuthenticationAthenz('{}');
29
-
30
- const authAthenz2: Pulsar.AuthenticationAthenz = new Pulsar.AuthenticationAthenz({
31
- tenantDomain: 'athenz.tenant.domain',
32
- tenantService: 'service',
33
- providerDomain: 'athenz.provider.domain',
34
- privateKey: 'file:///path/to/private.key',
35
- ztsUrl: 'https://localhost:8443',
36
- keyId: '0',
37
- principalHeader: 'Athenz-Principal-Auth',
38
- roleHeader: 'Athenz-Role-Auth',
39
- tokenExpirationTime: '3600',
40
- caCert: 'file:///path/to/cacert.pem',
41
- });
42
-
43
- const authAthenz3: Pulsar.AuthenticationAthenz = new Pulsar.AuthenticationAthenz({
44
- providerDomain: 'athenz.provider.domain',
45
- privateKey: 'file:///path/to/private.key',
46
- ztsUrl: 'https://localhost:8443',
47
- roleHeader: 'Athenz-Role-Auth',
48
- x509CertChain: 'file:///path/to/x509cert.pem',
49
- caCert: 'file:///path/to/cacert.pem',
50
- });
51
-
52
- const authOauth2PrivateKey: Pulsar.AuthenticationOauth2 = new Pulsar.AuthenticationOauth2({
53
- type: "client_credentials",
54
- issuer_url: "issuer-url",
55
- private_key: "credentials-file-path",
56
- audience: "audience",
57
- scope: "your-scope",
58
- });
59
-
60
- const authOauth2ClientId: Pulsar.AuthenticationOauth2 = new Pulsar.AuthenticationOauth2({
61
- type: "client_credentials",
62
- issuer_url: "issuer-url",
63
- client_id: "client-id",
64
- client_secret: "client-secret",
65
- audience: "audience",
66
- scope: "scope"
67
- });
68
-
69
- const authToken: Pulsar.AuthenticationToken = new Pulsar.AuthenticationToken({
70
- token: async () => {
71
- return 'foobar';
72
- },
73
- });
74
-
75
- const authBasic: Pulsar.AuthenticationBasic = new Pulsar.AuthenticationBasic({
76
- username: 'basic.username',
77
- password: 'basic.password',
78
- });
79
-
80
- const client: Pulsar.Client = new Pulsar.Client({
81
- serviceUrl: 'pulsar://localhost:6650',
82
- authentication: authToken,
83
- operationTimeoutSeconds: 30,
84
- ioThreads: 4,
85
- messageListenerThreads: 4,
86
- concurrentLookupRequest: 100,
87
- useTls: false,
88
- tlsTrustCertsFilePath: '/path/to/ca-cert.pem',
89
- tlsValidateHostname: false,
90
- tlsAllowInsecureConnection: false,
91
- statsIntervalInSeconds: 60,
92
- log: (level: Pulsar.LogLevel, file: string, line: number, message: string) => {
93
- switch (level) {
94
- case Pulsar.LogLevel.DEBUG:
95
- console.log(`[DEBUG] ${message}`);
96
- break;
97
- case Pulsar.LogLevel.INFO:
98
- console.log(`[INFO] ${message}`);
99
- break;
100
- case Pulsar.LogLevel.WARN:
101
- console.log(`[WARN] ${message}`);
102
- break;
103
- case Pulsar.LogLevel.ERROR:
104
- console.log(`[ERROR] ${message}`);
105
- break;
106
- }
107
- },
108
- });
109
-
110
- const producer1: Pulsar.Producer = await client.createProducer({
111
- topic: 'persistent://public/default/my-topic',
112
- producerName: 'producer1',
113
- sendTimeoutMs: 10000,
114
- initialSequenceId: 1,
115
- maxPendingMessages: 100,
116
- maxPendingMessagesAcrossPartitions: 1000,
117
- blockIfQueueFull: false,
118
- messageRoutingMode: 'UseSinglePartition',
119
- hashingScheme: 'Murmur3_32Hash',
120
- compressionType: 'Zlib',
121
- batchingEnabled: false,
122
- batchingMaxPublishDelayMs: 50,
123
- batchingMaxMessages: 100,
124
- properties: {
125
- key1: 'value1',
126
- key2: 'value2',
127
- },
128
- publicKeyPath: '/path/to/public.key',
129
- encryptionKey: 'encryption-key',
130
- cryptoFailureAction: 'FAIL',
131
- });
132
-
133
- const producer2: Pulsar.Producer = await client.createProducer({
134
- topic: 'persistent://public/default/my-topic',
135
- messageRoutingMode: 'RoundRobinDistribution',
136
- hashingScheme: 'BoostHash',
137
- compressionType: 'LZ4',
138
- cryptoFailureAction: 'SEND',
139
- });
140
-
141
- const producer3: Pulsar.Producer = await client.createProducer({
142
- topic: 'persistent://public/default/my-topic',
143
- messageRoutingMode: 'CustomPartition',
144
- hashingScheme: 'JavaStringHash',
145
- compressionType: 'ZSTD',
146
- });
147
-
148
- const producer4: Pulsar.Producer = await client.createProducer({
149
- topic: 'persistent://public/default/my-topic',
150
- compressionType: 'SNAPPY',
151
- });
152
-
153
- const producer5: Pulsar.Producer = await client.createProducer({
154
- topic: 'persistent://public/default/my-topic',
155
- schema: {
156
- name: 'my-schema',
157
- schemaType: "Json",
158
- schema: "my-json-schema",
159
- properties: {
160
- key1: 'value1',
161
- key2: 'value2'
162
- }
163
- }
164
- });
165
-
166
- const consumer1: Pulsar.Consumer = await client.subscribe({
167
- topic: 'persistent://public/default/my-topic',
168
- subscription: 'my-sub1',
169
- subscriptionType: 'Exclusive',
170
- subscriptionInitialPosition: 'Latest',
171
- ackTimeoutMs: 3000,
172
- nAckRedeliverTimeoutMs: 5000,
173
- receiverQueueSize: 1000,
174
- receiverQueueSizeAcrossPartitions: 5000,
175
- consumerName: 'consumer1',
176
- properties: {
177
- key1: 'value1',
178
- key2: 'value2',
179
- },
180
- readCompacted: false,
181
- privateKeyPath: '/path/to/private.key',
182
- cryptoFailureAction: 'FAIL',
183
- });
184
-
185
- const consumer2: Pulsar.Consumer = await client.subscribe({
186
- topic: 'persistent://public/default/my-topic',
187
- subscription: 'my-sub2',
188
- subscriptionType: 'Shared',
189
- subscriptionInitialPosition: 'Earliest',
190
- cryptoFailureAction: 'DISCARD',
191
- });
192
-
193
- const consumer3: Pulsar.Consumer = await client.subscribe({
194
- topic: 'persistent://public/default/my-topic',
195
- subscription: 'my-sub3',
196
- subscriptionType: 'KeyShared',
197
- listener: (message: Pulsar.Message, consumer: Pulsar.Consumer) => {
198
- },
199
- cryptoFailureAction: 'CONSUME',
200
- });
201
-
202
- const consumer4: Pulsar.Consumer = await client.subscribe({
203
- topic: 'persistent://public/default/my-topic',
204
- subscription: 'my-sub4',
205
- subscriptionType: 'Failover',
206
- });
207
-
208
- const consumer5: Pulsar.Consumer = await client.subscribe({
209
- topic: 'persistent://public/default/my-topic',
210
- subscription: 'my-sub5',
211
- schema: {
212
- name: 'my-schema',
213
- schemaType: "Json",
214
- schema: "my-json-schema",
215
- properties: {
216
- key1: 'value1',
217
- key2: 'value2'
218
- }
219
- }
220
- });
221
-
222
- const reader1: Pulsar.Reader = await client.createReader({
223
- topic: 'persistent://public/default/my-topic',
224
- startMessageId: Pulsar.MessageId.latest(),
225
- receiverQueueSize: 1000,
226
- readerName: 'reader1',
227
- subscriptionRolePrefix: 'reader-',
228
- readCompacted: false,
229
- });
230
-
231
- const reader2: Pulsar.Reader = await client.createReader({
232
- topic: 'persistent://public/default/my-topic',
233
- startMessageId: Pulsar.MessageId.earliest(),
234
- });
235
-
236
- const reader3: Pulsar.Reader = await client.createReader({
237
- topic: 'persistent://public/default/my-topic',
238
- startMessageId: Pulsar.MessageId.earliest(),
239
- listener: (message: Pulsar.Message, reader: Pulsar.Reader) => {
240
- },
241
- });
242
-
243
- const reader4: Pulsar.Reader = await client.createReader({
244
- topic: 'persistent://public/default/my-topic',
245
- startMessageId: Pulsar.MessageId.earliest(),
246
- privateKeyPath: '/path/to/private.key',
247
- });
248
-
249
- const reader5: Pulsar.Reader = await client.createReader({
250
- topic: 'persistent://public/default/my-topic',
251
- startMessageId: Pulsar.MessageId.earliest(),
252
- privateKeyPath: '/path/to/private.key',
253
- cryptoFailureAction: 'CONSUME',
254
- });
255
-
256
- const producerName: string = producer1.getProducerName();
257
- const topicName1: string = producer1.getTopic();
258
- const producerIsConnected: boolean = producer1.isConnected();
259
-
260
- const messageId1: Pulsar.MessageId = await producer1.send({
261
- data: Buffer.from('my-message'),
262
- properties: {
263
- key1: 'value1',
264
- key2: 'value2',
265
- },
266
- eventTimestamp: Date.now(),
267
- sequenceId: 10,
268
- partitionKey: 'key1',
269
- orderingKey: 'orderingKey1',
270
- replicationClusters: [
271
- 'cluster1',
272
- 'cluster2',
273
- ],
274
- deliverAfter: 30000,
275
- deliverAt: Date.now() + 30000,
276
- disableReplication: false,
277
- });
278
-
279
- const messageIdString: string = messageId1.toString();
280
- const messageIdBuffer: Buffer = messageId1.serialize();
281
- const messageId2: Pulsar.MessageId = Pulsar.MessageId.deserialize(messageIdBuffer);
282
-
283
- const message1: Pulsar.Message = await consumer1.receive();
284
- const message2: Pulsar.Message = await consumer2.receive(1000);
285
- const consumerIsConnected: boolean = consumer1.isConnected();
286
-
287
- consumer1.negativeAcknowledge(message1);
288
- consumer1.negativeAcknowledgeId(messageId1);
289
- consumer1.acknowledge(message1);
290
- consumer1.acknowledgeId(messageId1);
291
- consumer1.acknowledgeCumulative(message1);
292
- consumer1.acknowledgeCumulativeId(messageId1);
293
-
294
- const topicName2: string = message1.getTopicName();
295
- const properties: { [key: string]: string } = message1.getProperties();
296
- const messageBuffer: Buffer = message1.getData();
297
- const messageId3: Pulsar.MessageId = message1.getMessageId();
298
- const publishTime: number = message1.getPublishTimestamp();
299
- const eventTime: number = message1.getEventTimestamp();
300
- const redeliveryCount: number = message1.getRedeliveryCount();
301
- const partitionKey: string = message1.getPartitionKey();
302
-
303
- const message3: Pulsar.Message = await reader1.readNext();
304
- const message4: Pulsar.Message = await reader2.readNext(1000);
305
- const hasNext: boolean = reader1.hasNext();
306
- const readerIsConnected: boolean = reader1.isConnected();
307
-
308
- await producer1.flush();
309
- await producer1.close();
310
- await producer2.close();
311
- await producer3.close();
312
- await producer4.close();
313
- await producer5.close();
314
- await consumer1.unsubscribe();
315
- await consumer2.close();
316
- await consumer3.close();
317
- await consumer4.close();
318
- await consumer5.close();
319
- await reader1.close();
320
- await reader2.close();
321
- await reader3.close();
322
- await reader4.close();
323
- await reader5.close();
324
- await client.close();
325
- })();
326
-
327
- // Minimal parameters
328
- (async () => {
329
- const authAthenz: Pulsar.AuthenticationAthenz = new Pulsar.AuthenticationAthenz({
330
- tenantDomain: 'athenz.tenant.domain',
331
- tenantService: 'service',
332
- providerDomain: 'athenz.provider.domain',
333
- privateKey: 'file:///path/to/private.key',
334
- ztsUrl: 'https://localhost:8443',
335
- });
336
-
337
- const client: Pulsar.Client = new Pulsar.Client({
338
- serviceUrl: 'pulsar://localhost:6650',
339
- });
340
-
341
- const producer: Pulsar.Producer = await client.createProducer({
342
- topic: 'persistent://public/default/my-topic',
343
- });
344
-
345
- const consumer1: Pulsar.Consumer = await client.subscribe({
346
- topic: 'persistent://public/default/my-topic',
347
- subscription: 'my-sub1',
348
- });
349
-
350
- const consumer2: Pulsar.Consumer = await client.subscribe({
351
- topics: ['persistent://public/default/my-topic'],
352
- subscription: 'my-sub2',
353
- });
354
-
355
- const consumer3: Pulsar.Consumer = await client.subscribe({
356
- topicsPattern: 'persistent://public/default/my-topi[a-z]',
357
- subscription: 'my-sub3',
358
- });
359
-
360
- const reader: Pulsar.Reader = await client.createReader({
361
- topic: 'persistent://public/default/my-topic',
362
- startMessageId: Pulsar.MessageId.latest(),
363
- });
364
-
365
- const messageId: Pulsar.MessageId = await producer.send({
366
- data: Buffer.from('my-message'),
367
- });
368
-
369
- await producer.close();
370
- await consumer1.close();
371
- await consumer2.close();
372
- await consumer3.close();
373
- await reader.close();
374
- await client.close();
375
- })();
376
-
377
- // Missing required parameters
378
- (async () => {
379
- // @ts-expect-error
380
- const authAthenz: Pulsar.AuthenticationAthenz = new Pulsar.AuthenticationAthenz({
381
- });
382
-
383
- // @ts-expect-error
384
- const client: Pulsar.Client = new Pulsar.Client({
385
- });
386
-
387
- // @ts-expect-error
388
- const producer: Pulsar.Producer = await client.createProducer({
389
- });
390
-
391
- // @ts-expect-error
392
- const consumer: Pulsar.Consumer = await client.subscribe({
393
- });
394
-
395
- // @ts-expect-error
396
- const reader1: Pulsar.Reader = await client.createReader({
397
- topic: 'persistent://public/default/my-topic',
398
- });
399
-
400
- // @ts-expect-error
401
- const reader2: Pulsar.Reader = await client.createReader({
402
- startMessageId: Pulsar.MessageId.latest(),
403
- });
404
-
405
- // @ts-expect-error
406
- const messageId: Pulsar.MessageId = await producer.send({
407
- });
408
- })();
package/typedoc.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "entryPoints": ["index.d.ts"],
3
- "out": "apidocs",
4
- "name": "Apache Pulsar",
5
- "tsconfig": "tsconfig.json",
6
- "excludePrivate": true,
7
- "excludeProtected": true,
8
- "excludeExternals": true,
9
- "includeVersion": true,
10
- "githubPages": false,
11
- "navigationLinks": {
12
- "Homepage": "https://pulsar.apache.org/",
13
- "GitHub": "https://github.com/apache/pulsar-client-node"
14
- }
15
- }