@restorecommerce/kafka-client 0.4.1 → 0.4.4
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/CHANGELOG.md +27 -0
- package/lib/events/provider/kafka/index.js +12 -12
- package/lib/events/provider/local/index.js +1 -1
- package/package.json +25 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.4.4](https://github.com/restorecommerce/kafka-client/compare/@restorecommerce/kafka-client@0.4.3...@restorecommerce/kafka-client@0.4.4) (2022-08-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @restorecommerce/kafka-client
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.4.3](https://github.com/restorecommerce/kafka-client/compare/@restorecommerce/kafka-client@0.4.2...@restorecommerce/kafka-client@0.4.3) (2022-07-07)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @restorecommerce/kafka-client
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.4.2](https://github.com/restorecommerce/kafka-client/compare/@restorecommerce/kafka-client@0.4.1...@restorecommerce/kafka-client@0.4.2) (2022-06-28)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **kafka-client:** to print error message and stack instead of entire error object ([a7ee20f](https://github.com/restorecommerce/kafka-client/commit/a7ee20f77a464589b5935ccd780f74b96dbc68a1))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [0.4.1](https://github.com/restorecommerce/kafka-client/compare/@restorecommerce/kafka-client@0.4.0...@restorecommerce/kafka-client@0.4.1) (2022-06-10)
|
|
7
34
|
|
|
8
35
|
|
|
@@ -76,7 +76,7 @@ class Topic {
|
|
|
76
76
|
this.provider.logger.info(`Topic ${this.name} created successfully`);
|
|
77
77
|
resolve();
|
|
78
78
|
}).catch(err => {
|
|
79
|
-
this.provider.logger.error(`Cannot create topic ${this.name}:`, err);
|
|
79
|
+
this.provider.logger.error(`Cannot create topic ${this.name}:`, { code: err.code, message: err.message, stack: err.stack });
|
|
80
80
|
reject(err);
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -159,14 +159,14 @@ class Topic {
|
|
|
159
159
|
return this.provider.admin.fetchTopicOffsets(this.name).then(data => {
|
|
160
160
|
resolve(parseInt(data[0].offset, 10));
|
|
161
161
|
}).catch(err => {
|
|
162
|
-
this.provider.logger.error('Error occurred retrieving topic offset:', err);
|
|
162
|
+
this.provider.logger.error('Error occurred retrieving topic offset:', { code: err.code, message: err.message, stack: err.stack });
|
|
163
163
|
reject(err);
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
166
|
return this.provider.admin.fetchTopicOffsetsByTimestamp(this.name, time).then(data => {
|
|
167
167
|
resolve(parseInt(data[0].offset, 10));
|
|
168
168
|
}).catch(err => {
|
|
169
|
-
this.provider.logger.error('Error occurred retrieving topic offset:', err);
|
|
169
|
+
this.provider.logger.error('Error occurred retrieving topic offset:', { code: err.code, message: err.message, stack: err.stack });
|
|
170
170
|
reject(err);
|
|
171
171
|
});
|
|
172
172
|
});
|
|
@@ -251,7 +251,7 @@ class Topic {
|
|
|
251
251
|
this.provider.logger.info(`Consumer disconnected from topic ${this.name}`);
|
|
252
252
|
this.consumer = undefined;
|
|
253
253
|
}).catch((err) => {
|
|
254
|
-
this.provider.logger.error(`Error occurred unsubscribing ${eventName} on topic ${this.name}`, err);
|
|
254
|
+
this.provider.logger.error(`Error occurred unsubscribing ${eventName} on topic ${this.name}`, { code: err.code, message: err.message, stack: err.stack });
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
257
|
});
|
|
@@ -275,7 +275,7 @@ class Topic {
|
|
|
275
275
|
}
|
|
276
276
|
catch (error) {
|
|
277
277
|
// do not commit offset
|
|
278
|
-
logger.error(`topic ${context.topic} error`, error);
|
|
278
|
+
logger.error(`topic ${context.topic} error`, { code: error.code, message: error.message, stack: error.stack });
|
|
279
279
|
throw error;
|
|
280
280
|
}
|
|
281
281
|
}
|
|
@@ -308,14 +308,14 @@ class Topic {
|
|
|
308
308
|
yield this.consumer.connect().then(() => {
|
|
309
309
|
this.provider.logger.info(`Consumer for topic '${this.name}' connected`);
|
|
310
310
|
}).catch(err => {
|
|
311
|
-
this.provider.logger.error(`Consumer for topic '${this.name}' connection error:
|
|
311
|
+
this.provider.logger.error(`Consumer for topic '${this.name}' connection error`, { code: err.code, message: err.message, stack: err.stack });
|
|
312
312
|
});
|
|
313
313
|
yield this.consumer.subscribe({
|
|
314
314
|
topic: this.name
|
|
315
315
|
}).then(() => {
|
|
316
316
|
this.provider.logger.info(`Consumer for topic '${this.name}' subscribed`);
|
|
317
317
|
}).catch(err => {
|
|
318
|
-
this.provider.logger.error(`Consumer for topic '${this.name}' subscriber error:
|
|
318
|
+
this.provider.logger.error(`Consumer for topic '${this.name}' subscriber error`, { code: err.code, message: err.message, stack: err.stack });
|
|
319
319
|
});
|
|
320
320
|
// On receiving the message on Kafka consumer put the message to async Queue.
|
|
321
321
|
if (queue) {
|
|
@@ -332,7 +332,7 @@ class Topic {
|
|
|
332
332
|
}
|
|
333
333
|
})
|
|
334
334
|
}).catch(err => {
|
|
335
|
-
this.provider.logger.error(`Consumer for topic '${this.name}' failed to run:
|
|
335
|
+
this.provider.logger.error(`Consumer for topic '${this.name}' failed to run`, { code: err.code, message: err.message, stack: err.stack });
|
|
336
336
|
});
|
|
337
337
|
this.consumer.seek({
|
|
338
338
|
topic: this.name,
|
|
@@ -408,7 +408,7 @@ class Topic {
|
|
|
408
408
|
partition: 0 // ?
|
|
409
409
|
}
|
|
410
410
|
]).then(resolve).catch(err => {
|
|
411
|
-
this.provider.logger.error('Error committing offset
|
|
411
|
+
this.provider.logger.error('Error committing offset', { code: err.code, message: err.message, stack: err.stack });
|
|
412
412
|
reject(err);
|
|
413
413
|
});
|
|
414
414
|
});
|
|
@@ -601,7 +601,7 @@ class Kafka {
|
|
|
601
601
|
decodedMsg = MessageClass.decode(msg);
|
|
602
602
|
}
|
|
603
603
|
catch (err) {
|
|
604
|
-
this.logger.error(`error on decoding message with event ${eventName}
|
|
604
|
+
this.logger.error(`error on decoding message with event ${eventName}`, { message: msg, errorCode: err.code, errorMessage: err.message, errorStack: err.stack });
|
|
605
605
|
}
|
|
606
606
|
return decodedMsg;
|
|
607
607
|
}
|
|
@@ -651,13 +651,13 @@ class Kafka {
|
|
|
651
651
|
}
|
|
652
652
|
resolve(data);
|
|
653
653
|
}).catch((err) => {
|
|
654
|
-
this.logger.error(`error sending event ${eventName} to topic ${topicName}`, err);
|
|
654
|
+
this.logger.error(`error sending event ${eventName} to topic ${topicName}`, { code: err.code, message: err.message, stack: err.stack });
|
|
655
655
|
reject(err);
|
|
656
656
|
});
|
|
657
657
|
});
|
|
658
658
|
}
|
|
659
659
|
catch (err) {
|
|
660
|
-
this.logger.error(`error on sending event ${eventName} to topic ${topicName}`, err);
|
|
660
|
+
this.logger.error(`error on sending event ${eventName} to topic ${topicName}`, { code: err.code, message: err.message, stack: err.stack });
|
|
661
661
|
throw err;
|
|
662
662
|
}
|
|
663
663
|
});
|
|
@@ -83,7 +83,7 @@ class Topic {
|
|
|
83
83
|
return new Promise((resolve, reject) => {
|
|
84
84
|
root.load(protoFilePath, { keepCase: true }, (err, root) => {
|
|
85
85
|
if (err) {
|
|
86
|
-
that.logger.error('Error loading protobuf definition', err);
|
|
86
|
+
that.logger.error('Error loading protobuf definition', { message: err.message, stack: err.stack });
|
|
87
87
|
reject(err);
|
|
88
88
|
}
|
|
89
89
|
resolve(root);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restorecommerce/kafka-client",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Opinionated Kafka Client for Microservices",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"author": "n-fuse GmbH",
|
|
@@ -17,36 +17,36 @@
|
|
|
17
17
|
],
|
|
18
18
|
"typings": "lib/index.d.ts",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@restorecommerce/logger": "^0.13.
|
|
21
|
-
"async": "^3.2.
|
|
22
|
-
"cls-rtracer": "^2.
|
|
20
|
+
"@restorecommerce/logger": "^0.13.1",
|
|
21
|
+
"async": "^3.2.4",
|
|
22
|
+
"cls-rtracer": "^2.6.2",
|
|
23
23
|
"events": "^3.3.0",
|
|
24
|
-
"kafkajs": "^2.
|
|
24
|
+
"kafkajs": "^2.1.0",
|
|
25
25
|
"lodash": "^4.17.21",
|
|
26
|
-
"protobufjs": "^6.11.
|
|
26
|
+
"protobufjs": "^6.11.3",
|
|
27
27
|
"retry": "^0.13.1",
|
|
28
|
-
"winston": "^3.
|
|
28
|
+
"winston": "^3.8.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@types/async": "^3.2.
|
|
31
|
+
"@types/async": "^3.2.15",
|
|
32
32
|
"@types/long": "^4.0.2",
|
|
33
33
|
"@types/mocha": "^9.1.1",
|
|
34
|
-
"@types/node": "^
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
36
|
-
"@typescript-eslint/eslint-plugin-tslint": "^5.
|
|
37
|
-
"@typescript-eslint/parser": "^5.
|
|
34
|
+
"@types/node": "^18.0.3",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
36
|
+
"@typescript-eslint/eslint-plugin-tslint": "^5.30.5",
|
|
37
|
+
"@typescript-eslint/parser": "^5.30.5",
|
|
38
38
|
"coveralls": "^3.1.1",
|
|
39
39
|
"cross-env": "^7.0.3",
|
|
40
|
-
"eslint": "^8.
|
|
40
|
+
"eslint": "^8.19.0",
|
|
41
41
|
"eslint-plugin-prefer-arrow-functions": "^3.1.4",
|
|
42
42
|
"mocha": "^10.0.0",
|
|
43
43
|
"npm-run-all": "^4.1.5",
|
|
44
44
|
"nyc": "^15.1.0",
|
|
45
45
|
"rimraf": "^3.0.0",
|
|
46
46
|
"should": "^13.2.3",
|
|
47
|
-
"ts-node": "^10.
|
|
47
|
+
"ts-node": "^10.8.2",
|
|
48
48
|
"tslint": "^6.1.3",
|
|
49
|
-
"typescript": "^4.
|
|
49
|
+
"typescript": "^4.7.4"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"pretest": "npm run build && node setupTopics.js com.example.test",
|
|
@@ -62,5 +62,14 @@
|
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">= 12.0.0"
|
|
64
64
|
},
|
|
65
|
-
"
|
|
65
|
+
"nx": {
|
|
66
|
+
"targets": {
|
|
67
|
+
"build": {
|
|
68
|
+
"outputs": [
|
|
69
|
+
"./lib"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"gitHead": "d9c96be84651883aa79c607df9431c758d59a40c"
|
|
66
75
|
}
|