@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.
@@ -8,5 +8,5 @@ jobs:
8
8
  ci:
9
9
  uses: yarkivaev/npm-workflows/.github/workflows/ci.yml@main
10
10
  with:
11
- node-version: '22'
11
+ node-version: '22.22.1'
12
12
  lint: true
@@ -11,5 +11,5 @@ jobs:
11
11
  contents: write
12
12
  id-token: write
13
13
  with:
14
- node-version: '22'
14
+ node-version: '22.22.1'
15
15
  lint: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarkivaev/source-to-sink",
3
- "version": "1.2.4",
3
+ "version": "1.2.7",
4
4
  "description": "Generic library for building data streaming pipelines",
5
5
  "repository": {
6
6
  "type": "git",
@@ -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', async (readErr, body) => {
106
+ message.readString('utf-8', (readErr, body) => {
106
107
  if (readErr) { return; }
107
- try {
108
- await collector.accept({ destination, payload: body.toString() });
109
- channel.ack(message);
110
- } catch { channel.nack(message); }
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);