-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestSQS.js
61 lines (57 loc) · 1.49 KB
/
testSQS.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const AWS = require('aws-sdk');
AWS.config.update({region: 'us-west-2'});
AWS.events.on('retry', function (resp) {
if (['SignatureDoesNotMatch', 'InvalidSignatureException'].includes(resp.error.code)) {
resp.error.retryable = true;
}
});
const sqs = new AWS.SQS({region: 'us-west-2', correctClockSkew: true});
async function sendMessage (payload) {
let params = {
MessageBody: payload,
QueueUrl: 'https://sqs.us-west-2.amazonaws.com/079818613942/AWSGoogleCloudTestSignature',
};
return sqs.sendMessage(params).promise();
};
async function run() {
const message = JSON.stringify({
"kind": "youtube#searchListResponse",
"etag": "rwerwerwerwer",
"nextPageToken": "ewrwerwre",
"regionCode": "KE",
"pageInfo": {
"totalResults": 4249,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/QpOIr3QKlV5EUlzfFcVvDiJT0hw\"",
"id": {
"kind": "youtube#channel",
"channelId": "UCJowOS1R0FnhipXVqEnYU1A"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/AWutzVOt_5p1iLVifyBdfoSTf9E\"",
"id": {
"kind": "youtube#video",
"videoId": "Eqa2nAAhHN0"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/2dIR9BTfr7QphpBuY3hPU-h5u-4\"",
"id": {
"kind": "youtube#video",
"videoId": "IirngItQuVs"
}
}
]
});
for (let i = 0; i < process.env.NUM_MESSAGES; i++) {
await sendMessage(message);
}
};
run();