@sera4/essentia 1.0.33 → 1.0.35

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/index.js CHANGED
@@ -10,5 +10,5 @@ module.exports = {
10
10
  healthCheck : require("./health"),
11
11
  queue : require("./queue"),
12
12
  utils : require("./utils"),
13
- safePRoxy : require("./safe_proxy")
13
+ safeProxy : require("./safe_proxy")
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sera4/essentia",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "description": "A library of utilities for Teleporte Web Services",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/package.tar.gz CHANGED
Binary file
package/queue/index.js CHANGED
@@ -171,6 +171,22 @@ class S4Queue {
171
171
  this.pubs[name] = p;
172
172
  }
173
173
 
174
+ /**
175
+ * Registers a new fanout publisher on the given exchange.
176
+ * If exchange doesn't exist, one will be created.
177
+ * @param {String} exchange the name of the exchange on AMQP service.
178
+ */
179
+ async registerFanoutPublisher(exchange) {
180
+ const name = exchange;
181
+ if (Object.keys(this.pubs).includes(name)) {
182
+ throw new Error(`Publisher ${name} already registered`);
183
+ }
184
+
185
+ const p = new Publisher(exchange, 'fanout', true, name);
186
+ await p.init(this.connection);
187
+ this.pubs[name] = p;
188
+ }
189
+
174
190
  /**
175
191
  * Registers a new direct subscriber on a given exchange and queue.
176
192
  * If exchange and queue don't exists, they'll be created
@@ -291,4 +307,4 @@ class S4Queue {
291
307
  }
292
308
  }
293
309
 
294
- module.exports = new S4Queue();
310
+ module.exports = new S4Queue();