sqs-service
v1.0.2
Published
AWS Simple Queue Service(SQS) supporting long-polling long-lived process worker consuming queue
Downloads
3
Maintainers
Readme
aws-sqs-service
AWS Simple Queue Service(SQS)
Requirement
Enviroment variables - IAM credentials
export AWS_ACCESS_KEY_ID=your-id
export AWS_SECRET_ACCESS_KEY=your-secret
Install
npm i -S sqs-service
Usage
Config
const QueueService = require('aws-sqs-service');
const sqs = new QueueService(options);
options
- region -- required
- batchSize -- The maximum number of messages to return. valid value 1 to 10. Default 1.
- apiVersion
Send Message to Queue
sqs.sendMessage(url, payload) //url -> queueUrl, payload -> JSON object
Consume from Queue
sqs.consume(url, function(data, done) => {
//doSomethingWith(data)
//done()
//doSomethingAsyncWith(data)
// .then(_ => done())
})