@xnestjs/kafka 1.6.2 → 1.6.3
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/cjs/kafka-core.module.js
CHANGED
|
@@ -115,14 +115,14 @@ let KafkaCoreModule = KafkaCoreModule_1 = class KafkaCoreModule {
|
|
|
115
115
|
}
|
|
116
116
|
async onApplicationBootstrap() {
|
|
117
117
|
const options = this.connectionOptions;
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
118
|
+
if (options.lazyConnect)
|
|
119
|
+
return;
|
|
120
|
+
this.logger?.log('Connecting to Kafka brokers' + (Array.isArray(options.brokers) ? colors.blue(options.brokers.join(',')) : ''));
|
|
121
|
+
common_1.Logger.flush();
|
|
122
|
+
await this.client.connect().catch(e => {
|
|
123
|
+
this.logger?.error('Kafka connection failed: ' + e.message);
|
|
124
|
+
throw e;
|
|
125
|
+
});
|
|
126
126
|
}
|
|
127
127
|
onApplicationShutdown() {
|
|
128
128
|
return this.client.close();
|
package/esm/kafka-core.module.js
CHANGED
|
@@ -112,14 +112,14 @@ let KafkaCoreModule = KafkaCoreModule_1 = class KafkaCoreModule {
|
|
|
112
112
|
}
|
|
113
113
|
async onApplicationBootstrap() {
|
|
114
114
|
const options = this.connectionOptions;
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
115
|
+
if (options.lazyConnect)
|
|
116
|
+
return;
|
|
117
|
+
this.logger?.log('Connecting to Kafka brokers' + (Array.isArray(options.brokers) ? colors.blue(options.brokers.join(',')) : ''));
|
|
118
|
+
Logger.flush();
|
|
119
|
+
await this.client.connect().catch(e => {
|
|
120
|
+
this.logger?.error('Kafka connection failed: ' + e.message);
|
|
121
|
+
throw e;
|
|
122
|
+
});
|
|
123
123
|
}
|
|
124
124
|
onApplicationShutdown() {
|
|
125
125
|
return this.client.close();
|