-
Notifications
You must be signed in to change notification settings - Fork 12
/
sender.js
36 lines (28 loc) · 891 Bytes
/
sender.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* Example of lambda function which send message with big content to SQS.
*/
const SqsExtendedClient = require('sqs-extended-client');
const DEFAULT_MESSAGE_SIZE_THRESHOLD = 262144;
const QUEUE_URL = '--YOUR-QUEUE-URL--'
const sqsClientConfig = { region: 'eu-west-2'};
const s3ClientConfig = { region: 'eu-west-2'};
const sqsExtendedClient = new SqsExtendedClient({
sqsClientConfig,
s3ClientConfig,
bucketName: '--BUCKET-NAME--',
messageSizeThreshold: DEFAULT_MESSAGE_SIZE_THRESHOLD
});
const handler = async (event, context ) => {
const content = '--BIG-CONTENT--';
const sqsResponse = await sqsExtendedClient.sendMessage({
QueueUrl: QUEUE_URL,
MessageBody: JSON.stringify(content),
});
return {
statusCode: 200,
body: {
MessageId: sqsResponse.MessageId,
}
}
}
module.exports = { handler }