@message-queue-toolkit/sqs 24.2.0 → 24.2.1
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
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @message-queue-toolkit/sqs
|
|
2
2
|
|
|
3
|
-
AWS SQS (Simple Queue Service) implementation for the message-queue-toolkit. Provides a robust, type-safe abstraction
|
|
3
|
+
AWS SQS (Simple Queue Service) implementation for the message-queue-toolkit. Provides a robust, type-safe abstraction
|
|
4
|
+
for publishing and consuming messages from both standard and FIFO SQS queues.
|
|
4
5
|
|
|
5
6
|
## Table of Contents
|
|
6
7
|
|
|
@@ -70,7 +71,7 @@ Publishers send messages to SQS queues. They handle:
|
|
|
70
71
|
- Message validation against Zod schemas
|
|
71
72
|
- Automatic serialization
|
|
72
73
|
- Optional deduplication (preventing duplicate sends)
|
|
73
|
-
- Optional payload offloading (for messages >
|
|
74
|
+
- Optional payload offloading (for messages > 1 MiB)
|
|
74
75
|
- FIFO-specific concerns (MessageGroupId, MessageDeduplicationId)
|
|
75
76
|
|
|
76
77
|
### Consumers
|
|
@@ -379,7 +380,7 @@ When using `creationConfig`, the queue will be created automatically if it doesn
|
|
|
379
380
|
|
|
380
381
|
// Other attributes
|
|
381
382
|
DelaySeconds: '0', // Default delay for all messages
|
|
382
|
-
MaximumMessageSize: '
|
|
383
|
+
MaximumMessageSize: '1048576', // 1 MiB (default maximum)
|
|
383
384
|
},
|
|
384
385
|
tags: {
|
|
385
386
|
Environment: 'production',
|
|
@@ -456,7 +457,7 @@ When using `locatorConfig`, you connect to an existing queue without creating it
|
|
|
456
457
|
// Optional - Payload Offloading
|
|
457
458
|
payloadStoreConfig: {
|
|
458
459
|
payloadStore: s3Store, // S3-based payload store
|
|
459
|
-
maxPayloadSize:
|
|
460
|
+
maxPayloadSize: 1024 * 1024, // 1 MiB
|
|
460
461
|
},
|
|
461
462
|
|
|
462
463
|
// Optional - Deletion
|
|
@@ -754,7 +755,7 @@ Prevents processing the same message multiple times:
|
|
|
754
755
|
|
|
755
756
|
### Payload Offloading
|
|
756
757
|
|
|
757
|
-
For messages larger than
|
|
758
|
+
For messages larger than 1 MiB, store the payload externally (e.g., S3):
|
|
758
759
|
|
|
759
760
|
```typescript
|
|
760
761
|
import { S3PayloadStore } from '@message-queue-toolkit/s3-payload-store'
|
|
@@ -768,7 +769,7 @@ const payloadStore = new S3PayloadStore({
|
|
|
768
769
|
{
|
|
769
770
|
payloadStoreConfig: {
|
|
770
771
|
payloadStore,
|
|
771
|
-
maxPayloadSize:
|
|
772
|
+
maxPayloadSize: 1024 * 1024, // 1 MiB threshold
|
|
772
773
|
},
|
|
773
774
|
}
|
|
774
775
|
|
|
@@ -776,7 +777,7 @@ const payloadStore = new S3PayloadStore({
|
|
|
776
777
|
await publisher.publish({
|
|
777
778
|
id: '123',
|
|
778
779
|
messageType: 'document.processed',
|
|
779
|
-
largeData: hugeArrayOfData, // If total size >
|
|
780
|
+
largeData: hugeArrayOfData, // If total size > 1 MiB, stored in S3
|
|
780
781
|
})
|
|
781
782
|
```
|
|
782
783
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbstractQueueService } from '@message-queue-toolkit/core';
|
|
2
2
|
import { deleteSqs, initSqs } from "../utils/sqsInitter.js";
|
|
3
3
|
// https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/quotas-messages.html
|
|
4
|
-
export const SQS_MESSAGE_MAX_SIZE =
|
|
4
|
+
export const SQS_MESSAGE_MAX_SIZE = 1024 * 1024; // 1 MiB
|
|
5
5
|
export const SQS_RESOURCE_ANY = Symbol('any');
|
|
6
6
|
export const SQS_RESOURCE_CURRENT_QUEUE = Symbol('current_queue');
|
|
7
7
|
export class AbstractSqsService extends AbstractQueueService {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractSqsService.js","sourceRoot":"","sources":["../../lib/sqs/AbstractSqsService.ts"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AAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,OAAO,CACrD,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,WAAW,EAChB,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CACxB,CAAA;QACD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;IACvB,CAAC;IAEe,KAAK;QACnB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;QACtB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;CACF"}
|
package/dist/utils/sqsUtils.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare function deleteQueue(client: SQSClient, queueName: string, waitFo
|
|
|
16
16
|
/**
|
|
17
17
|
* Calculates the size of an outgoing SQS message.
|
|
18
18
|
*
|
|
19
|
-
* SQS imposes a
|
|
19
|
+
* SQS imposes a 1 MiB limit on the total size of a message, which includes both the message body and any metadata (attributes).
|
|
20
20
|
* This function currently computes the size based solely on the message body, as no attributes are included at this time.
|
|
21
21
|
* For future updates, if message attributes are added, their sizes should also be considered.
|
|
22
22
|
*
|
package/dist/utils/sqsUtils.js
CHANGED
|
@@ -180,7 +180,7 @@ export async function deleteQueue(client, queueName, waitForConfirmation = true)
|
|
|
180
180
|
/**
|
|
181
181
|
* Calculates the size of an outgoing SQS message.
|
|
182
182
|
*
|
|
183
|
-
* SQS imposes a
|
|
183
|
+
* SQS imposes a 1 MiB limit on the total size of a message, which includes both the message body and any metadata (attributes).
|
|
184
184
|
* This function currently computes the size based solely on the message body, as no attributes are included at this time.
|
|
185
185
|
* For future updates, if message attributes are added, their sizes should also be considered.
|
|
186
186
|
*
|