sqs-generator
v0.0.2
Published
sqs-generator is a library to execute AWS SQS messages with ES6 generator.
Downloads
2
Readme
sqs-generator
sqs-generator is a library to execute AWS SQS messages with ES6 generator.
Installation
npm install -S sqs-generator
Usage
const sqsGenerator = require('sqs-generator');
const gen = sqsGenerator.create({
queueUrl: 'QUEUE_URL',
sqs: {
credential: {
accessKeyId: 'ACCESS_KEY_ID',
secretAccessKey: 'SECRET_ACCESS_KEY',
region: 'us-east-1'
}
},
onMessage: function*(message) {
console.log(message.Body);
return true; // return true to delete message
},
onError(err) {
console.error(err);
}
});
gen.start();
gen.stop();