@itentialopensource/adapter-kafkav2 0.13.0 → 0.15.0

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 CHANGED
@@ -1,4 +1,20 @@
1
1
 
2
+ ## 0.15.0 [08-04-2023]
3
+
4
+ * Add logic to clean topics.json from service config
5
+
6
+ See merge request itentialopensource/adapters/notification-messaging/adapter-kafkav2!11
7
+
8
+ ---
9
+
10
+ ## 0.14.0 [08-04-2023]
11
+
12
+ * Add logic to clean topics.json from service config
13
+
14
+ See merge request itentialopensource/adapters/notification-messaging/adapter-kafkav2!11
15
+
16
+ ---
17
+
2
18
  ## 0.13.0 [08-03-2023]
3
19
 
4
20
  * Add seperate sasl props for consumer and producer
package/adapter.js CHANGED
@@ -349,12 +349,45 @@ class Kafkav2 extends AdapterBaseCl {
349
349
  processed: 0,
350
350
  subscribers: 99999,
351
351
  avro: useAvro,
352
- subInfo
352
+ subInfo,
353
+ source: 'props'
353
354
  });
354
355
  }
355
356
  }
356
357
  }
357
358
 
359
+ // check if service config doesnt have a topic and the source was props, delete it from topics
360
+ for (let te = 0; te < this.topicsEvents.length; te += 1) {
361
+ let topicFound = false;
362
+ for (let t = 0; t < this.props.topics.length; t += 1) {
363
+ if (this.topicsEvents[te].topic === this.props.topics[t].name && this.topicsEvents[te].source) {
364
+ if (this.topicsEvents[te].subInfo) {
365
+ const { subInfo } = this.topicsEvents[te];
366
+ for (let sub = 0; sub < subInfo.length; sub += 1) {
367
+ let subFound = false;
368
+ for (let s = 0; s < this.props.topics[t].subscriberInfo.length; s += 1) {
369
+ // if the subscriber is found, no need to add anything
370
+ if (subInfo[sub].subname === this.props.topics[t].subscriberInfo[s].subname) {
371
+ subFound = true;
372
+ break;
373
+ }
374
+ }
375
+ if (subFound === false) {
376
+ this.topicsEvents[te].subInfo.splice(sub, 1);
377
+ }
378
+ }
379
+ }
380
+ topicFound = true;
381
+ }
382
+ }
383
+ if (topicFound === false && this.topicsEvents[te].source === 'props') {
384
+ this.topicsEvents.splice(te, 1);
385
+ const split = topicsFile.split('/');
386
+ log.debug(`Update ${split[split.length - 1]} file.`);
387
+ fs.writeFileSync(topicsFile, JSON.stringify(this.topicsEvents, null, 2));
388
+ }
389
+ }
390
+
358
391
  // if we need to restart the adapter due to changes to pronghorn.json
359
392
  if (needRestart) {
360
393
  fs.writeFileSync(pronghornFile, JSON.stringify(pjson, null, 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-kafkav2",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
4
4
  "description": "Itential adapter to connect to kafka",
5
5
  "main": "adapter.js",
6
6
  "wizardVersion": "2.35.0",
Binary file
@@ -9,12 +9,9 @@
9
9
  "interval_time": 5000,
10
10
  "stub": false,
11
11
  "client": {
12
- "logLevel": "logLevel.DEBUG",
13
12
  "brokers": [
14
13
  "localhost:9092"
15
- ],
16
- "ssl": {},
17
- "sasl": {}
14
+ ]
18
15
  },
19
16
  "producer": {
20
17
  "allowAutoTopicCreation": true