@itentialopensource/adapter-kafkav2 0.6.0 → 0.6.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.
- package/CHANGELOG.md +8 -0
- package/adapter.js +7 -2
- package/package.json +1 -1
- package/refs?service=git-upload-pack +0 -0
package/CHANGELOG.md
CHANGED
package/adapter.js
CHANGED
|
@@ -178,11 +178,15 @@ class Kafkav2 extends AdapterBaseCl {
|
|
|
178
178
|
|
|
179
179
|
// put topics from file into memory
|
|
180
180
|
this.topicsEvents = [];
|
|
181
|
-
|
|
181
|
+
let topicsFile = path.join(__dirname, `/.topics-${this.id}.json`);
|
|
182
182
|
|
|
183
183
|
// if the file does not exist - error
|
|
184
184
|
if (fs.existsSync(topicsFile)) {
|
|
185
185
|
this.topicsEvents = JSON.parse(fs.readFileSync(topicsFile, 'utf-8'));
|
|
186
|
+
} else if (fs.existsSync(path.join(__dirname, '/.topics.json'))) {
|
|
187
|
+
log.debug('Found old .topics.json file.');
|
|
188
|
+
topicsFile = path.join(__dirname, '/.topics.json');
|
|
189
|
+
this.topicsEvents = JSON.parse(fs.readFileSync(topicsFile, 'utf-8'));
|
|
186
190
|
}
|
|
187
191
|
|
|
188
192
|
// get the topics into the right format --- fix older .topics.json files so they have the right format
|
|
@@ -395,7 +399,8 @@ class Kafkav2 extends AdapterBaseCl {
|
|
|
395
399
|
const intTime = this.props.interval_time || 30000;
|
|
396
400
|
setInterval(() => {
|
|
397
401
|
try {
|
|
398
|
-
|
|
402
|
+
const split = topicsFile.split('/');
|
|
403
|
+
log.debug(`Update ${split[split.length - 1]} file.`);
|
|
399
404
|
fs.writeFileSync(topicsFile, JSON.stringify(this.topicsEvents, null, 2));
|
|
400
405
|
} catch (err) {
|
|
401
406
|
log.error(err);
|
package/package.json
CHANGED
|
Binary file
|