Skip to content

Commit 7aebdcb

Browse files
committed
Document messageAttributes argument of SQS.sendmessage
1 parent c3f0348 commit 7aebdcb

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/data/markdown/docs/20 jslib/01 jslib/01 aws/SQSClient/00 sendMessage.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@ excerpt: "SQSClient.sendMessage sends a message to the specified Amazon SQS queu
1212
| :------------ | :---------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1313
| `queueUrl` | string | The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive. |
1414
| `messageBody` | string | The message to send. The minimum size is one character. The maximum size is 256 KB. |
15-
| `options` | object (optional) | Options for the request. Accepted properties are `messageDeduplicationId` (optional string) setting the message deduplication id, and `messageGroupId` (optional string) setting the message group ID for FIFO queues |
15+
| `options` | [SendMessageOptions](#sendmessageoptions) (optional) | Options for the request. |
16+
17+
#### SendMessageOptions
18+
19+
| Name | Type | Description |
20+
| :------------------------ | :----- | :---------------------------------------------------------------------------------------------- |
21+
| `messageDeduplicationId` | string (optional) | his parameter applies only to FIFO (first-in-first-out) queues. The token used for deduplication of sent messages. If a message with a particular MessageDeduplicationId is sent successfully, any messages sent with the same MessageDeduplicationId are accepted successfully but aren't delivered during the 5-minute deduplication interval. |
22+
| `messageGroupId` | string (optional) | The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). |
23+
| `messageAttributes` | object (optional) | Each message attribute consists of a `Name`, `Type`, and `Value`. For more information, see [Amazon SQS Message Attributes](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html). |
24+
| `delaySeconds` | number (optional) | The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive `delaySeconds` value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue applies. |
1625

1726
### Returns
1827

@@ -47,7 +56,22 @@ export default async function () {
4756
}
4857

4958
// Send message to test queue
50-
await sqs.sendMessage(testQueue, JSON.stringify({value: '123'}));
59+
await sqs.sendMessage(testQueue, 'test', {
60+
messageAttributes: {
61+
'test-string': {
62+
type: 'String',
63+
value: 'test'
64+
},
65+
'test-number': {
66+
type: 'Number',
67+
value: '23'
68+
},
69+
'test-binary': {
70+
type: 'Binary',
71+
value: 'dGVzdA=='
72+
}
73+
}
74+
});
5175
}
5276
```
5377

0 commit comments

Comments
 (0)