@xnestjs/kafka 1.13.0 → 1.13.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.
@@ -95,6 +95,7 @@ let KafkaCoreModule = KafkaCoreModule_1 = class KafkaCoreModule {
95
95
  this.client = client;
96
96
  this.connectionOptions = connectionOptions;
97
97
  this.logger = logger;
98
+ this.logger = logger || new Logger('Kafka');
98
99
  }
99
100
  async onApplicationBootstrap() {
100
101
  const options = this.connectionOptions;
@@ -115,18 +116,22 @@ let KafkaCoreModule = KafkaCoreModule_1 = class KafkaCoreModule {
115
116
  };
116
117
  if (options.lazyConnect || !options.brokers)
117
118
  return;
118
- this.logger?.log('Testing to Kafka brokers' +
119
- (Array.isArray(options.brokers)
120
- ? colors.blue(options.brokers.join(','))
121
- : ''));
119
+ const brokersText = Array.isArray(options.brokers)
120
+ ? colors.blue(options.brokers.join(','))
121
+ : '';
122
+ const logTimer = setTimeout(() => {
123
+ this.logger?.verbose(`Waiting to connect to Kafka brokers [${colors.blue(brokersText)}]`);
124
+ }, 1000);
122
125
  Logger.flush();
123
126
  const admin = this.client.admin();
124
127
  try {
125
128
  await admin.connect();
126
129
  await admin.fetchTopicMetadata(); // this will fail if Kafka is not reachable
127
- this.logger?.log('Kafka connection is healthy');
130
+ clearTimeout(logTimer);
131
+ this.logger?.log(`Kafka connection established`);
128
132
  }
129
133
  catch (error) {
134
+ clearTimeout(logTimer);
130
135
  this.logger?.error('Kafka connection failed: ' + error.message);
131
136
  throw error;
132
137
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@xnestjs/kafka",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "NestJS extension library for Kafka",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
- "@jsopen/objects": "^2.0.2",
8
+ "@jsopen/objects": "^2.1.0",
9
9
  "ansi-colors": "^4.1.3",
10
- "putil-varhelpers": "^1.6.5",
10
+ "putil-varhelpers": "^1.7.0",
11
11
  "tslib": "^2.8.1"
12
12
  },
13
13
  "peerDependencies": {