@yarkivaev/scada 2.4.3 → 2.4.4
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
|
@@ -81,6 +81,7 @@ async function topology(channel, queue, options) {
|
|
|
81
81
|
export default function amqpSource(url, queue, collector, options = {}) {
|
|
82
82
|
if (!collector || typeof collector.accept !== 'function') { throw new Error('Collector must have an accept() method'); }
|
|
83
83
|
const settings = capacity(options);
|
|
84
|
+
if (![undefined, true, false].includes(settings.exclusive)) { throw new TypeError('AMQP exclusive must be boolean'); }
|
|
84
85
|
const pending = new Set();
|
|
85
86
|
const state = {};
|
|
86
87
|
const session = amqpSession(url, async (channel) => {
|
|
@@ -89,7 +90,7 @@ export default function amqpSource(url, queue, collector, options = {}) {
|
|
|
89
90
|
return state.session.active() && state.session.generation() === generation;
|
|
90
91
|
} };
|
|
91
92
|
const name = await topology(channel, queue, settings);
|
|
92
|
-
const result = await channel.consume(name, trackedConsume(channel, collector, config, pending), { noAck: false });
|
|
93
|
+
const result = await channel.consume(name, trackedConsume(channel, collector, config, pending), { noAck: false, ...(settings.exclusive ? { exclusive: true } : {}) });
|
|
93
94
|
return result.consumerTag;
|
|
94
95
|
}, { ...settings, drain() { return Promise.all([...pending]); } });
|
|
95
96
|
state.session = session;
|