@yarkivaev/source-to-sink 1.2.4 → 1.2.7
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/.github/workflows/ci.yml
CHANGED
package/package.json
CHANGED
package/src/stompSource.js
CHANGED
|
@@ -99,15 +99,18 @@ export default function stompSource(url, destination, collector, options = {}) {
|
|
|
99
99
|
maxReconnects: -1
|
|
100
100
|
});
|
|
101
101
|
const channel = new stompit.Channel(failover);
|
|
102
|
+
let pending = Promise.resolve();
|
|
102
103
|
const subscribe = { destination, ack: 'client-individual' };
|
|
103
104
|
channel.subscribe(subscribe, (err, message) => {
|
|
104
105
|
if (err) { return; }
|
|
105
|
-
message.readString('utf-8',
|
|
106
|
+
message.readString('utf-8', (readErr, body) => {
|
|
106
107
|
if (readErr) { return; }
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
pending = pending.then(async () => {
|
|
109
|
+
try {
|
|
110
|
+
await collector.accept({ destination, payload: body.toString() });
|
|
111
|
+
channel.ack(message);
|
|
112
|
+
} catch { channel.nack(message); }
|
|
113
|
+
});
|
|
111
114
|
});
|
|
112
115
|
});
|
|
113
116
|
state = subscribed(channel);
|