kafka-ts 1.0.3 → 1.1.0
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.
- package/README.md +1 -0
- package/dist/broker.d.ts +1 -0
- package/dist/broker.js +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +2 -0
- package/dist/cluster.d.ts +1 -0
- package/dist/cluster.js +3 -1
- package/dist/connection.d.ts +1 -0
- package/dist/connection.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -141,6 +141,7 @@ The existing high-level libraries (e.g. kafkajs) are missing a few crucial featu
|
|
|
141
141
|
| bootstrapServers | TcpSocketConnectOpts[] | true | | List of kafka brokers for initial cluster discovery. |
|
|
142
142
|
| sasl | SASLProvider | false | | SASL provider |
|
|
143
143
|
| ssl | TLSSocketOptions | false | | SSL configuration. |
|
|
144
|
+
| requestTimeout | number | false | 60000 | Request timeout in milliseconds. |
|
|
144
145
|
|
|
145
146
|
#### Supported SASL mechanisms
|
|
146
147
|
|
package/dist/broker.d.ts
CHANGED
package/dist/broker.js
CHANGED
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -12,6 +12,7 @@ class Client {
|
|
|
12
12
|
clientId: options.clientId ?? null,
|
|
13
13
|
sasl: options.sasl ?? null,
|
|
14
14
|
ssl: options.ssl ?? null,
|
|
15
|
+
requestTimeout: options.requestTimeout ?? 60_000,
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
18
|
async startConsumer(options) {
|
|
@@ -28,6 +29,7 @@ class Client {
|
|
|
28
29
|
bootstrapServers: this.options.bootstrapServers,
|
|
29
30
|
sasl: this.options.sasl,
|
|
30
31
|
ssl: this.options.ssl,
|
|
32
|
+
requestTimeout: this.options.requestTimeout,
|
|
31
33
|
});
|
|
32
34
|
}
|
|
33
35
|
}
|
package/dist/cluster.d.ts
CHANGED
package/dist/cluster.js
CHANGED
|
@@ -54,6 +54,7 @@ class Cluster {
|
|
|
54
54
|
clientId: this.options.clientId,
|
|
55
55
|
sasl: this.options.sasl,
|
|
56
56
|
ssl: this.options.ssl,
|
|
57
|
+
requestTimeout: this.options.requestTimeout,
|
|
57
58
|
options: this.brokerMetadata[nodeId],
|
|
58
59
|
});
|
|
59
60
|
await broker.connect();
|
|
@@ -63,10 +64,11 @@ class Cluster {
|
|
|
63
64
|
const randomizedBrokers = this.options.bootstrapServers.toSorted(() => Math.random() - 0.5);
|
|
64
65
|
for (const options of randomizedBrokers) {
|
|
65
66
|
try {
|
|
66
|
-
const broker =
|
|
67
|
+
const broker = new broker_1.Broker({
|
|
67
68
|
clientId: this.options.clientId,
|
|
68
69
|
sasl: this.options.sasl,
|
|
69
70
|
ssl: this.options.ssl,
|
|
71
|
+
requestTimeout: this.options.requestTimeout,
|
|
70
72
|
options,
|
|
71
73
|
});
|
|
72
74
|
await broker.connect();
|
package/dist/connection.d.ts
CHANGED
package/dist/connection.js
CHANGED
|
@@ -105,7 +105,7 @@ class Connection {
|
|
|
105
105
|
timeout = setTimeout(() => {
|
|
106
106
|
delete this.queue[correlationId];
|
|
107
107
|
reject(new error_1.ConnectionError(`${apiName} timed out`));
|
|
108
|
-
},
|
|
108
|
+
}, this.options.requestTimeout);
|
|
109
109
|
try {
|
|
110
110
|
this.queue[correlationId] = { resolve, reject };
|
|
111
111
|
await this.write(requestEncoder.value());
|