-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqs_sendMessage.js
More file actions
42 lines (35 loc) · 1002 Bytes
/
sqs_sendMessage.js
File metadata and controls
42 lines (35 loc) · 1002 Bytes
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
const AWS = require('aws-sdk');
const keys = require('./config.js');
const inboxUrl = 'https://sqs.us-west-2.amazonaws.com/503244390256/test-inbox';
const outboxUrl = 'https://sqs.us-west-2.amazonaws.com/503244390256/test-outbox';
AWS.config.update({accessKeyId: keys.accessKeyId ,
secretAccessKey: keys.secretAccessKey,
region: 'us-west-2'});
const sqs = new AWS.SQS({apiVersion: '2012-11-05'});
const spinUpOneMessage = () => {
const params = {
DelaySeconds: 10,
MessageAttributes: {
'Title': {
DataType: 'String',
StringValue: 'The Whistler'
},
'RandomNumber': {
DataType: 'Number',
StringValue: (Math.floor(Math.random() * 10000)).toString()
}
},
MessageBody: 'Information about current NY Times fiction bestseller for week of 12/11/2016.',
QueueUrl: inboxUrl
};
sqs.sendMessage(params, (err, data) => {
if (err) {
} else {
}
});
}
let i = 0;
while (i < 200) {
spinUpOneMessage();
i++
}