@sera4/essentia 1.0.35 → 1.0.36

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": "@sera4/essentia",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
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
@@ -289,6 +289,28 @@ class S4Queue {
289
289
  return await p.publish({key: topic, content});
290
290
  }
291
291
 
292
+ /**
293
+ * Binds an exchange to a queue
294
+ * @param {String} exchange the name of the exchange.
295
+ * @param {String} queue the name of the queue.
296
+ * @param {pattern} (optional) pattern for routing key
297
+ */
298
+ async bindQueueToExchange(exchange, queue, pattern) {
299
+ const p = this.pubs[exchange];
300
+
301
+ if (!p) {
302
+ throw(new Error(`No PUB for ${exchange} found`));
303
+ }
304
+
305
+ if (!queue) {
306
+ throw(new Error(`Binding a queue requires a queue name`));
307
+ }
308
+
309
+ return await p.bindQueue(queue, pattern)
310
+ }
311
+
312
+
313
+
292
314
  /**
293
315
  * Adds a listener for a specific key.
294
316
  * If a subscriber that was regitered was found
@@ -80,8 +80,12 @@ class Publisher {
80
80
 
81
81
  return parcel.tracking_id;
82
82
  }
83
+
84
+ async bindQueue(queue, pattern, args) {
85
+ await this.channel.bindQueue(queue, this.exchange, pattern, args)
86
+ }
83
87
  }
84
88
 
85
89
  module.exports = {
86
90
  Publisher
87
- }
91
+ }