@lucaapp/service-utils 1.59.3 → 1.59.5

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.
@@ -158,7 +158,11 @@ class KafkaClient {
158
158
  const topic = await this.getTopic(kafkaTopic);
159
159
  const groupId = `${this.environment.valueOf()}_${kafkaTopic.valueOf()}_${this.serviceIdentity.identityName}`;
160
160
  try {
161
- const consumer = this.kafkaClient.consumer({ groupId });
161
+ const consumer = this.kafkaClient.consumer({
162
+ groupId,
163
+ sessionTimeout: 20000, // 20 seconds
164
+ heartbeatInterval: 3000, // 3 seconds
165
+ });
162
166
  this.consumers.push(consumer);
163
167
  await consumer.connect();
164
168
  await consumer.subscribe({ topic, fromBeginning });
@@ -177,7 +181,12 @@ class KafkaClient {
177
181
  value,
178
182
  timestamp: message.timestamp,
179
183
  }, 'Record received');
180
- await handler({ ...message, value });
184
+ try {
185
+ await handler({ ...message, value });
186
+ }
187
+ catch (error) {
188
+ throw (0, utils_1.logAndGetError)(this.logger, `Could not consume message for groupId=${groupId}, topic=${topic}, message=${value}`, error);
189
+ }
181
190
  messageAcknowledgedCounter
182
191
  .labels({ topic: kafkaTopic.valueOf(), groupId })
183
192
  .inc();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucaapp/service-utils",
3
- "version": "1.59.3",
3
+ "version": "1.59.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -76,6 +76,7 @@
76
76
  "semver": "7.5.2",
77
77
  "follow-redirects": "1.15.6",
78
78
  "braces": "3.0.3",
79
- "send": "0.19.0"
79
+ "send": "0.19.0",
80
+ "rollup": "4.22.4"
80
81
  }
81
82
  }