Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/homuchen/aws-sqs-service
AWS Simple Queue Service(SQS) supporting long-polling long-lived process worker consuming jobs in queue
https://github.com/homuchen/aws-sqs-service
sqs worker
Last synced: about 1 month ago
JSON representation
AWS Simple Queue Service(SQS) supporting long-polling long-lived process worker consuming jobs in queue
- Host: GitHub
- URL: https://github.com/homuchen/aws-sqs-service
- Owner: HoMuChen
- Created: 2019-05-13T10:13:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-13T10:53:55.000Z (over 5 years ago)
- Last Synced: 2024-10-09T18:07:35.259Z (3 months ago)
- Topics: sqs, worker
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/sqs-service
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# aws-sqs-service
AWS Simple Queue Service(SQS)## Requirement
Enviroment variables - IAM credentials
```bash
export AWS_ACCESS_KEY_ID=your-id
export AWS_SECRET_ACCESS_KEY=your-secret
```## Install
```bash
npm i -S sqs-service
```## Usage
### Config
```js
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
```js
sqs.sendMessage(url, payload) //url -> queueUrl, payload -> JSON object
```### Consume from Queue
```js
sqs.consume(url, function(data, done) => {
//doSomethingWith(data)
//done()
//doSomethingAsyncWith(data)
// .then(_ => done())
})
```