@yarkivaev/source-to-sink 1.3.9 → 1.3.10
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/README.md +2 -0
- package/package.json +1 -1
- package/src/stompSource.js +2 -2
- package/test/test_stompSource.js +30 -0
package/README.md
CHANGED
|
@@ -47,3 +47,5 @@ integer to tune throughput. A zero (unlimited) window is rejected because a
|
|
|
47
47
|
backlog can otherwise exhaust the consumer's heap. With `manualAck: true`, the
|
|
48
48
|
collector remains responsible for settling frames. If it flushes only by count,
|
|
49
49
|
its batch must not exceed the prefetch window; a timed flush also avoids stalls.
|
|
50
|
+
|
|
51
|
+
Manual collectors may call `settle.nack(false)` to dead-letter invalid messages. Configure a durable dead-letter queue and broker policy before enabling this; without a route RabbitMQ discards rejected messages. `settle.nack()` retains retry behaviour.
|
package/package.json
CHANGED
package/src/stompSource.js
CHANGED
package/test/test_stompSource.js
CHANGED
|
@@ -114,3 +114,33 @@ describe('STOMP delivery window', function() {
|
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
describe('STOMP dead lettering', function() {
|
|
120
|
+
it('sends requeue=false for a rejected poison message', async function() {
|
|
121
|
+
const original = stompit.Channel;
|
|
122
|
+
let receive;
|
|
123
|
+
let headers;
|
|
124
|
+
stompit.Channel = function Channel() {
|
|
125
|
+
return {
|
|
126
|
+
subscribe(value, callback) { receive = callback; },
|
|
127
|
+
nack(message, value) { headers = value; },
|
|
128
|
+
close() {}
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
try {
|
|
132
|
+
const source = stompSource('stomp://localhost:61613', '/queue/test', {
|
|
133
|
+
accept({ settle }) { settle.nack(false); }
|
|
134
|
+
}, { manualAck: true });
|
|
135
|
+
source.start();
|
|
136
|
+
receive(null, { readString(encoding, callback) { callback(null, '{}'); } });
|
|
137
|
+
await new Promise((resolve) => { setImmediate(resolve); });
|
|
138
|
+
source.stop();
|
|
139
|
+
assert.deepStrictEqual(headers, { requeue: 'false' });
|
|
140
|
+
} finally {
|
|
141
|
+
// Test restores its synchronous module stub after delivery completes.
|
|
142
|
+
// eslint-disable-next-line require-atomic-updates
|
|
143
|
+
stompit.Channel = original;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|