@avtechno/sfr 1.0.9 → 1.0.11

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.
@@ -37,10 +37,9 @@ export class SFRPipeline {
37
37
  async init(base_url) {
38
38
  this.base_url = base_url;
39
39
  if (this.comms["MQ"]) {
40
- const channel = await this.comms["MQ"].createChannel();
41
40
  //Create channels for each type of Communication Pattern
42
41
  const channels = await Promise.all(PATTERNS.map(async (v) => {
43
- const mq = TARGETED_PATTERN.includes(v) ? new TargetedMQ(channel, v) : new BroadcastMQ(channel, v);
42
+ const mq = TARGETED_PATTERN.includes(v) ? new TargetedMQ(this.comms["MQ"], v) : new BroadcastMQ(this.comms["MQ"], v);
44
43
  return [v, mq];
45
44
  }));
46
45
  this.pattern_channels = Object.fromEntries(channels);
@@ -213,6 +212,7 @@ export class SFRPipeline {
213
212
  if (mq instanceof BroadcastMQ) {
214
213
  mq.channel.reject(msg, false);
215
214
  }
215
+ return; //Return immediately to avoid executing handler fn (which may contain reply or ack calls.)
216
216
  }
217
217
  handler.fn(msg);
218
218
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avtechno/sfr",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "An opinionated way of writing services using ExpressJS.",
5
5
  "type": "module",
6
6
  "files": [
@@ -37,10 +37,9 @@ export class SFRPipeline {
37
37
  async init(base_url?: string): Promise<ServiceDocuments> {
38
38
  this.base_url = base_url;
39
39
  if(this.comms["MQ"]){
40
- const channel = await this.comms["MQ"].createChannel();
41
40
  //Create channels for each type of Communication Pattern
42
41
  const channels = await Promise.all(PATTERNS.map(async (v) => {
43
- const mq = TARGETED_PATTERN.includes(v) ? new TargetedMQ(channel, v) : new BroadcastMQ(channel, v);
42
+ const mq = TARGETED_PATTERN.includes(v) ? new TargetedMQ(this.comms["MQ"], v) : new BroadcastMQ(this.comms["MQ"], v);
44
43
 
45
44
  return [v, mq];
46
45
  }));
@@ -223,6 +222,8 @@ export class SFRPipeline {
223
222
  if (mq instanceof BroadcastMQ) {
224
223
  mq.channel.reject(msg, false);
225
224
  }
225
+
226
+ return; //Return immediately to avoid executing handler fn (which may contain reply or ack calls.)
226
227
  }
227
228
 
228
229
  handler.fn(msg);
@@ -259,7 +259,7 @@ declare type NamespaceDeclaration = {
259
259
  declare type SFRProtocols = {
260
260
  REST?: Express;
261
261
  WS?: Server;
262
- MQ?: ChannelModel;
262
+ MQ?: Channel;
263
263
  }
264
264
 
265
265
  declare type Operation = "Read" | "Write";