@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 +1 -1
- package/package.tar.gz +0 -0
- package/queue/index.js +22 -0
- package/queue/publisher.js +5 -1
package/package.json
CHANGED
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
|
package/queue/publisher.js
CHANGED