@itentialopensource/adapter-kafkav2 0.8.2 → 0.9.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,12 @@
1
1
 
2
+ ## 0.9.0 [07-18-2023]
3
+
4
+ * Add seperate sasl props for consumer and producer
5
+
6
+ See merge request itentialopensource/adapters/notification-messaging/adapter-kafkav2!10
7
+
8
+ ---
9
+
2
10
  ## 0.8.2 [07-18-2023]
3
11
 
4
12
  * Update dependencies and add fromBeginnimg config
package/README.md CHANGED
@@ -277,6 +277,8 @@ The following properties are used to define the Kafka Client. These properties a
277
277
 
278
278
  | Property | Description |
279
279
  | ------- | ------- |
280
+ | consumersasl | Object, SASL authentication configuration for consumer. This is optional if you provide sasl. ex. { mechanism: 'plain', username: 'foo', password: 'bar' }|
281
+ | producersasl | Object, SASL authentication configuration for producer. This is optional if you provide sasl. ex. { mechanism: 'plain', username: 'foo', password: 'bar' }|
280
282
  | brokers | kafka broker:port list |
281
283
  | clientId | Client-id is a logical grouping of clients with a meaningful name chosen by the client application |
282
284
  | ssl | Object, options to be passed to the tls broker sockets, ex. { rejectUnauthorized: false }.|
package/adapter.js CHANGED
@@ -373,6 +373,8 @@ class Kafkav2 extends AdapterBaseCl {
373
373
  }
374
374
 
375
375
  this.KafkaClient = null;
376
+ this.KafkaProducerClient = null;
377
+ this.KafkaConsumerClient = null;
376
378
  this.producer = null;
377
379
  this.consumer = null;
378
380
  this.registryUrl = null;
@@ -447,9 +449,21 @@ class Kafkav2 extends AdapterBaseCl {
447
449
 
448
450
  this.KafkaClient = new Kafka(combinedProps);
449
451
 
450
- this.producer = this.KafkaClient.producer(this.props.producer || {});
452
+ if (this.props.client && this.props.client.producersasl) {
453
+ combinedProps.sasl = this.props.client.producersasl;
454
+ this.KafkaProducerClient = new Kafka(combinedProps);
455
+ this.producer = this.KafkaProducerClient.producer(this.props.producer || {});
456
+ } else {
457
+ this.producer = this.KafkaClient.producer(this.props.producer || {});
458
+ }
451
459
 
452
- this.consumer = this.KafkaClient.consumer(this.props.consumer || {});
460
+ if (this.props.client && this.props.client.consumersasl) {
461
+ combinedProps.sasl = this.props.client.consumersasl;
462
+ this.KafkaConsumerClient = new Kafka(combinedProps);
463
+ this.consumer = this.KafkaConsumerClient.consumer(this.props.consumer || {});
464
+ } else {
465
+ this.consumer = this.KafkaClient.consumer(this.props.consumer || {});
466
+ }
453
467
 
454
468
  const isPassingFiltering = (topic, message, filters) => {
455
469
  const topicConfig = this.topicsEvents.find((e) => e.topic === topic);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-kafkav2",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "Itential adapter to connect to kafka",
5
5
  "main": "adapter.js",
6
6
  "wizardVersion": "2.35.0",
Binary file