kafka-ts 0.0.14 → 0.0.16
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/dist/connection.js
CHANGED
|
@@ -131,15 +131,13 @@ class Consumer extends events_1.default {
|
|
|
131
131
|
});
|
|
132
132
|
await this.fetchManager.start();
|
|
133
133
|
if (!nodeAssignments.length) {
|
|
134
|
-
|
|
135
|
-
await (0, delay_1.delay)(this.options.maxWaitMs);
|
|
136
|
-
this.consumerGroup?.handleLastHeartbeat();
|
|
134
|
+
await this.waitForReassignment();
|
|
137
135
|
}
|
|
138
136
|
}
|
|
139
137
|
catch (error) {
|
|
140
138
|
await this.fetchManager?.stop();
|
|
141
139
|
if (error.errorCode === api_1.API_ERROR.REBALANCE_IN_PROGRESS) {
|
|
142
|
-
logger_1.log.debug('Rebalance in progress...');
|
|
140
|
+
logger_1.log.debug('Rebalance in progress...', { apiName: error.apiName });
|
|
143
141
|
continue;
|
|
144
142
|
}
|
|
145
143
|
if (error.errorCode === api_1.API_ERROR.FENCED_INSTANCE_ID) {
|
|
@@ -162,6 +160,14 @@ class Consumer extends events_1.default {
|
|
|
162
160
|
}
|
|
163
161
|
this.stopHook?.();
|
|
164
162
|
}
|
|
163
|
+
async waitForReassignment() {
|
|
164
|
+
const { groupId } = this.options;
|
|
165
|
+
logger_1.log.debug('No partitions assigned. Waiting for reassignment...', { groupId });
|
|
166
|
+
while (!this.stopHook) {
|
|
167
|
+
await (0, delay_1.delay)(1000);
|
|
168
|
+
this.consumerGroup?.handleLastHeartbeat();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
165
171
|
async process(messages) {
|
|
166
172
|
const { options } = this;
|
|
167
173
|
const { retrier } = options;
|
package/dist/utils/error.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare class KafkaTSApiError<T = any> extends KafkaTSError {
|
|
|
5
5
|
errorCode: number;
|
|
6
6
|
errorMessage: string | null;
|
|
7
7
|
response: T;
|
|
8
|
+
apiName: string | undefined;
|
|
8
9
|
request: unknown | undefined;
|
|
9
10
|
constructor(errorCode: number, errorMessage: string | null, response: T);
|
|
10
11
|
}
|
package/dist/utils/error.js
CHANGED
|
@@ -13,6 +13,7 @@ class KafkaTSApiError extends KafkaTSError {
|
|
|
13
13
|
errorCode;
|
|
14
14
|
errorMessage;
|
|
15
15
|
response;
|
|
16
|
+
apiName;
|
|
16
17
|
request;
|
|
17
18
|
constructor(errorCode, errorMessage, response) {
|
|
18
19
|
const [errorName] = Object.entries(api_1.API_ERROR).find(([, value]) => value === errorCode) ?? ['UNKNOWN'];
|