0.0.2 • Published 9 years ago
node-aws-sqs-stream v0.0.2
node-aws-sqs-stream
A readable stream of data from AWS SQS
Using the stream
var SqsStream = require('node-aws-sqs-stream');
var config = {
aws: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_KEY,
region: process.env.AWS_REGION
},
stream: {
},
sqs: {
QueueUrl: process.env.AWS_SQS_QUEUE_URL,
AttributeNames: [
'All'
],
MaxNumberOfMessages: 10,
VisibilityTimeout: 60,
WaitTimeSeconds: 3
}
}
var stream = new SqsStream(config);
stream.on('data', function(message){
console.log(message);
});
Testing
Unit tests
A suite of unit test can be run that do not require any connection to AWS SQS.
npm test
Integration Tests
A simple test to ensure that the module can connect to AWS, read messages from a queue and broadcast them down the stream/
npm run-script integrationTest
In order to run this test AWS access credentials must be provided either in env variables or in a .env file at the root of the project.
AWS_ACCESS_KEY_ID=
AWS_SECRET_KEY=
AWS_REGION=