sqs-consumer 14.2.0 → 14.2.1-canary.2
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/CHANGELOG.md +6 -32
- package/README.md +44 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,35 +1,9 @@
|
|
|
1
|
-
## [14.2.
|
|
2
|
-
|
|
3
|
-
### Features
|
|
4
|
-
|
|
5
|
-
* Preserve AWSError as cause when rethrowing as SQSError ([#662](https://github.com/bbc/sqs-consumer/issues/662)) ([be74bda](https://github.com/bbc/sqs-consumer/commit/be74bda07b04397643adb8bfe519fcb81b049e34))
|
|
1
|
+
## [14.2.1-canary.2](https://github.com/bbc/sqs-consumer/compare/v14.2.1-canary.1...v14.2.1-canary.2) (2025-12-15)
|
|
6
2
|
|
|
7
3
|
### Chores
|
|
8
4
|
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* **deps
|
|
12
|
-
* **deps
|
|
13
|
-
* **deps
|
|
14
|
-
* **deps-dev:** bump @typescript-eslint/eslint-plugin ([#645](https://github.com/bbc/sqs-consumer/issues/645)) ([d0b8784](https://github.com/bbc/sqs-consumer/commit/d0b87840920f2be837015eb6d8dc13874e804bf8))
|
|
15
|
-
* **deps-dev:** bump eslint from 9.36.0 to 9.37.0 ([#631](https://github.com/bbc/sqs-consumer/issues/631)) ([ad1bf72](https://github.com/bbc/sqs-consumer/commit/ad1bf72bad55838c0ca264d2797cfd9bb3830c72))
|
|
16
|
-
* **deps-dev:** bump eslint from 9.37.0 to 9.38.0 ([#642](https://github.com/bbc/sqs-consumer/issues/642)) ([f686c45](https://github.com/bbc/sqs-consumer/commit/f686c45132a003551dc949ca2196d88b1bd5bf79))
|
|
17
|
-
* **deps-dev:** bump js-yaml ([#660](https://github.com/bbc/sqs-consumer/issues/660)) ([dbded25](https://github.com/bbc/sqs-consumer/commit/dbded25e5b38b2a1702c197d978eb9130aafc775))
|
|
18
|
-
* **deps-dev:** bump typedoc from 0.28.13 to 0.28.14 ([#643](https://github.com/bbc/sqs-consumer/issues/643)) ([ff04703](https://github.com/bbc/sqs-consumer/commit/ff0470391dc221e03e6af0eb1925c73e0f367580))
|
|
19
|
-
* **deps:** bump @aws-sdk/client-sqs from 3.901.0 to 3.911.0 ([#636](https://github.com/bbc/sqs-consumer/issues/636)) ([fe33548](https://github.com/bbc/sqs-consumer/commit/fe3354839219b24acb21adad857c212c1ca1409b))
|
|
20
|
-
* **deps:** bump actions/checkout from 5.0.0 to 6.0.1 ([#658](https://github.com/bbc/sqs-consumer/issues/658)) ([7437eb6](https://github.com/bbc/sqs-consumer/commit/7437eb69bcd849a16b7af16baa6ee834428f35f6))
|
|
21
|
-
* **deps:** bump actions/dependency-review-action from 4.8.1 to 4.8.2 ([#646](https://github.com/bbc/sqs-consumer/issues/646)) ([a68e32e](https://github.com/bbc/sqs-consumer/commit/a68e32e14dd7f03f8919fc8c8dd48a027e149513))
|
|
22
|
-
* **deps:** bump actions/setup-node from 5.0.0 to 6.0.0 ([#627](https://github.com/bbc/sqs-consumer/issues/627)) ([f000859](https://github.com/bbc/sqs-consumer/commit/f0008594886d2e0adfe5277691f2077307ae18a9))
|
|
23
|
-
* **deps:** bump actions/setup-node from 6.0.0 to 6.1.0 ([#661](https://github.com/bbc/sqs-consumer/issues/661)) ([3d1cd30](https://github.com/bbc/sqs-consumer/commit/3d1cd3082da74386945e9f128c01202c3ccaeab8))
|
|
24
|
-
* **deps:** bump actions/stale from 10.1.0 to 10.1.1 ([#659](https://github.com/bbc/sqs-consumer/issues/659)) ([437d1eb](https://github.com/bbc/sqs-consumer/commit/437d1eb2fbb748e3850bf795d45e065d607019de))
|
|
25
|
-
* **deps:** bump actions/upload-artifact from 4.6.2 to 5.0.0 ([#638](https://github.com/bbc/sqs-consumer/issues/638)) ([618911c](https://github.com/bbc/sqs-consumer/commit/618911cc71db194c6c6040da66851022dcae1489))
|
|
26
|
-
* **deps:** bump dorny/test-reporter from 2.1.1 to 2.3.0 ([#656](https://github.com/bbc/sqs-consumer/issues/656)) ([c981884](https://github.com/bbc/sqs-consumer/commit/c9818847f25d9a6739c0dcf93714357ecfb8549c))
|
|
27
|
-
* **deps:** bump github/codeql-action from 4.30.8 to 4.31.2 ([#640](https://github.com/bbc/sqs-consumer/issues/640)) ([6eb9c12](https://github.com/bbc/sqs-consumer/commit/6eb9c12ccf0081bcf32412e48a07fd6afc520d9e))
|
|
28
|
-
* **deps:** bump github/codeql-action from 4.31.2 to 4.31.6 ([#657](https://github.com/bbc/sqs-consumer/issues/657)) ([e671dfd](https://github.com/bbc/sqs-consumer/commit/e671dfd41a1bdc16c995b0d6ce3fd15c82c1e750))
|
|
29
|
-
* **deps:** bump the npm_and_yarn group across 1 directory with 1 update ([#651](https://github.com/bbc/sqs-consumer/issues/651)) ([dbd969f](https://github.com/bbc/sqs-consumer/commit/dbd969fec2b9d0d43909383e072739e6bfc01f5c))
|
|
30
|
-
* trying a different permissions placement ([c951306](https://github.com/bbc/sqs-consumer/commit/c951306636c23759e7f3168d3b888f32bbb31f5d))
|
|
31
|
-
* undoing change ([7ff35d2](https://github.com/bbc/sqs-consumer/commit/7ff35d2d2ce43dfe000b772388fcf096ec73a5ac))
|
|
32
|
-
* update brace-expansion ([6b4d508](https://github.com/bbc/sqs-consumer/commit/6b4d508ef83fdfbe49498f38e67d81a1602cd469))
|
|
33
|
-
* update npx commands ([f4c195c](https://github.com/bbc/sqs-consumer/commit/f4c195c43bf43dc03cff9bb5514d5c0e63e7ef86))
|
|
34
|
-
* update package version ([62a5d6c](https://github.com/bbc/sqs-consumer/commit/62a5d6c109ad49f736952a681e7de514d426d7df))
|
|
35
|
-
* whoops we don't use pnpm yet ([aeed6e6](https://github.com/bbc/sqs-consumer/commit/aeed6e6d3e8bfae457cd4fa3c4854b569cb7f78d))
|
|
5
|
+
* **deps-dev:** bump p-event from 7.0.0 to 7.0.1 ([#668](https://github.com/bbc/sqs-consumer/issues/668)) ([9a95442](https://github.com/bbc/sqs-consumer/commit/9a9544206ac0c2a1fc5f6512d7f84b2031b8f580))
|
|
6
|
+
* **deps:** bump actions/upload-artifact from 5.0.0 to 6.0.0 ([#671](https://github.com/bbc/sqs-consumer/issues/671)) ([cd8a729](https://github.com/bbc/sqs-consumer/commit/cd8a72903073ffdeabdcb620e93d9e3c2fce1a14))
|
|
7
|
+
* **deps:** bump dessant/lock-threads from 5.0.1 to 6.0.0 ([#670](https://github.com/bbc/sqs-consumer/issues/670)) ([42f4f81](https://github.com/bbc/sqs-consumer/commit/42f4f81798ef53b1beb0c744d66781228e9b3c07))
|
|
8
|
+
* **deps:** bump github/codeql-action from 4.31.7 to 4.31.8 ([#669](https://github.com/bbc/sqs-consumer/issues/669)) ([afdbb9f](https://github.com/bbc/sqs-consumer/commit/afdbb9fc35f15a8d80c54702e2219631f0b5fda0))
|
|
9
|
+
* **deps:** bump zgosalvez/github-actions-report-lcov ([#672](https://github.com/bbc/sqs-consumer/issues/672)) ([54d336a](https://github.com/bbc/sqs-consumer/commit/54d336ab360974e8d720164c6c994e6ed044473a))
|
package/README.md
CHANGED
|
@@ -136,6 +136,50 @@ By default, the value of `abort` is set to `false` which means pre existing requ
|
|
|
136
136
|
|
|
137
137
|
`consumer.stop({ abort: true })`
|
|
138
138
|
|
|
139
|
+
#### Graceful shutdowns
|
|
140
|
+
|
|
141
|
+
Calling `consumer.stop()` on its own only prevents new polls from being scheduled. The consumer will emit `stopped` immediately, even if the current long poll or message handler is still running. To wait for the final poll plus any in-flight message processing to finish, set `pollingCompleteWaitTimeMs` to the maximum amount of time you are willing to wait.
|
|
142
|
+
|
|
143
|
+
- While waiting, the consumer emits `waiting_for_polling_to_complete` every second.
|
|
144
|
+
- If the timeout elapses first, `waiting_for_polling_to_complete_timeout_exceeded` fires right before `stopped`.
|
|
145
|
+
- For graceful shutdowns keep `abort: false` (the default). Passing `abort: true` cancels the shared `AbortController`, which halts heartbeat extensions and prevents acknowledgements/deletions from finishing.
|
|
146
|
+
|
|
147
|
+
Here's an example of a graceful shutdown implementation:
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
const consumer = Consumer.create({
|
|
151
|
+
queueUrl: "https://sqs.eu-west-1.amazonaws.com/account-id/queue-name",
|
|
152
|
+
handleMessage: async (message) => {
|
|
153
|
+
await doWork(message);
|
|
154
|
+
return message;
|
|
155
|
+
},
|
|
156
|
+
pollingCompleteWaitTimeMs: 10_000, // This will allow up to 10s for the last poll + handler
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const shutdown = (signal) => {
|
|
160
|
+
console.log(`Received ${signal}, waiting for in-flight work...`);
|
|
161
|
+
consumer.stop();
|
|
162
|
+
|
|
163
|
+
consumer.once("waiting_for_polling_to_complete", () => {
|
|
164
|
+
console.log("Still processing in-flight messages...");
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
consumer.once("waiting_for_polling_to_complete_timeout_exceeded", () => {
|
|
168
|
+
console.warn("Graceful shutdown timed out, continuing shutdown anyway.");
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
consumer.once("stopped", () => {
|
|
172
|
+
console.log("Consumer stopped cleanly");
|
|
173
|
+
process.exit(0);
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
process.once("SIGINT", shutdown);
|
|
178
|
+
process.once("SIGTERM", shutdown);
|
|
179
|
+
|
|
180
|
+
consumer.start();
|
|
181
|
+
```
|
|
182
|
+
|
|
139
183
|
### `consumer.status`
|
|
140
184
|
|
|
141
185
|
Returns the current status of the consumer.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sqs-consumer",
|
|
3
|
-
"version": "14.2.
|
|
3
|
+
"version": "14.2.1-canary.2",
|
|
4
4
|
"description": "Build SQS-based Node applications without the boilerplate",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
"eslint-config-eslint": "^13.0.0",
|
|
172
172
|
"jsr": "^0.13.5",
|
|
173
173
|
"mocha": "^11.7.4",
|
|
174
|
-
"p-event": "^7.0.
|
|
174
|
+
"p-event": "^7.0.1",
|
|
175
175
|
"prettier": "^3.6.2",
|
|
176
176
|
"semantic-release": "^25.0.2",
|
|
177
177
|
"sinon": "^21.0.0",
|