@jetit/publisher 1.7.1 → 1.7.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetit/publisher",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "type": "commonjs",
5
5
  "dependencies": {
6
6
  "@jetit/id": "0.0.11",
@@ -8,7 +8,7 @@
8
8
  "rxjs": "^7.8.0"
9
9
  },
10
10
  "peerDependencies": {
11
- "tslib": "2.5.0"
11
+ "tslib": "^2.3.0"
12
12
  },
13
13
  "main": "./src/index.js",
14
14
  "types": "./src/index.d.ts"
@@ -7,9 +7,7 @@ class RedisRegistry {
7
7
  static attemptConnection(connectionKey, storeRef = 0) {
8
8
  let ref;
9
9
  if (RedisRegistry.options.cluster) {
10
- ref = new ioredis_1.Cluster(RedisRegistry.options.cluster.nodes, Object.assign(Object.assign({}, RedisRegistry.options.cluster.options), { redisOptions: {
11
- db: storeRef,
12
- } }));
10
+ ref = new ioredis_1.Cluster(RedisRegistry.options.cluster.nodes, Object.assign(Object.assign({}, RedisRegistry.options.cluster.options), { redisOptions: Object.assign(Object.assign({}, RedisRegistry.options.cluster.options.redisOptions), { db: storeRef }) }));
13
11
  }
14
12
  ref = new ioredis_1.default(Object.assign(Object.assign({}, RedisRegistry.options.redis), { db: storeRef }));
15
13
  RedisRegistry.registry.set(connectionKey, ref);
@@ -20,9 +18,7 @@ class RedisRegistry {
20
18
  let ref = this.registry.get(connectionKey);
21
19
  if (!ref) {
22
20
  if (RedisRegistry.options.cluster) {
23
- ref = new ioredis_1.Cluster(RedisRegistry.options.cluster.nodes, Object.assign(Object.assign({}, RedisRegistry.options.cluster.options), { redisOptions: {
24
- db: storeRef,
25
- } }));
21
+ ref = new ioredis_1.Cluster(RedisRegistry.options.cluster.nodes, Object.assign(Object.assign({}, RedisRegistry.options.cluster.options), { redisOptions: Object.assign(Object.assign({}, RedisRegistry.options.cluster.options.redisOptions), { db: storeRef }) }));
26
22
  }
27
23
  ref = new ioredis_1.default(Object.assign(Object.assign({}, RedisRegistry.options.redis), { db: storeRef }));
28
24
  }
@@ -116,6 +116,8 @@ class Streams {
116
116
  throw new Error('Publisher Error');
117
117
  });
118
118
  }
119
+ else
120
+ console.log(`PUBLISHER: Event publish failed for event ${data.eventName}, reason: no consumers ${consumerGroups}`);
119
121
  });
120
122
  }
121
123
  scheduledPublish(scheduledTime, eventData, uniquePerInstance = false, repeatInterval = 0) {
@@ -195,8 +197,8 @@ class Streams {
195
197
  pipeline.sadd(key, eventName);
196
198
  pipeline.sadd(`${eventName}`, this.consumerGroupName);
197
199
  pipeline.set(setKeyForK8sHandling, this.consumerGroupName);
198
- const [, createConsumerStatus, , ,] = (yield pipeline.exec());
199
- console.log(`PUBLISHER: Consumer Registered and created with ${this.instanceId} under ${this.consumerGroupName} with the ${createConsumerStatus[1]} consumers`);
200
+ const [, createConsumerStatus, addToCGSet, addToFlushSet] = (yield pipeline.exec());
201
+ console.log(`PUBLISHER: Consumer Registered and created with ${this.instanceId} under ${this.consumerGroupName} with ${createConsumerStatus[1]} consumers and with the following status ${JSON.stringify({ addToCGSet, addToFlushSet })}`);
200
202
  return createConsumerStatus[1] === 0 || createConsumerStatus[1] === 1;
201
203
  });
202
204
  }
@@ -262,7 +264,7 @@ class Streams {
262
264
  })}`);
263
265
  });
264
266
  eventStreamClient.on('message', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
265
- console.log(`PUBLISHER: Stream Notification Recieved for event ${eventName}`);
267
+ console.log(`PUBLISHER: Stream Notification Received for event ${eventName}`);
266
268
  yield processMessage(this.redisGroups);
267
269
  }));
268
270
  this.scanAndClaimAUnclaimedMessage(streamName)