# sqs-aws-sdk

> Push and pull from SQS using the AWS SDK

Latest version **1.0.0** (published 2015-07-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install sqs-aws-sdk
pnpm add sqs-aws-sdk
yarn add sqs-aws-sdk
bun add sqs-aws-sdk
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-07-06 |
| First published | 2015-07-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Matteo Collina |
| Maintainers | matteo.collina |
| Keywords | SQS, AWS, SDK |

## Links

- npm: https://www.npmjs.com/package/sqs-aws-sdk
- Repository: https://github.com/mcollina/sqs-aws-sdk
- Homepage: https://github.com/mcollina/sqs-aws-sdk#readme
- Issues: https://github.com/mcollina/sqs-aws-sdk/issues
- npm.io page: https://npm.io/package/sqs-aws-sdk

## Dependencies (6)

- [debug](https://npm.io/package/debug.md) ^2.2.0
- [xtend](https://npm.io/package/xtend.md) ^4.0.0
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.1.36
- [fastfall](https://npm.io/package/fastfall.md) ^1.2.3
- [lru-cache](https://npm.io/package/lru-cache.md) ^2.6.5
- [fastparallel](https://npm.io/package/fastparallel.md) ^1.5.3

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-07-06

## README

# sqs-aws-sdk&nbsp;&nbsp;[![Build Status](https://travis-ci.org/mcollina/sqs-aws-sdk.png)](https://travis-ci.org/mcollina/sqs-aws-sdk)

A message queue using [Amazon Simple Queue
Service](http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/APIReference/Welcome.html) using the AWS SDK.
This module has the same interface of [sqs](http://npm.im/sqs), but uses
the [AWS SDK](http://npm.im/aws-sdk) instead of a custom API wrapper.

## Install

```
npm install sqs-aws-sdk
```

## Usage

```js
var AWS = require('aws-sdk')

// see the AWS SQS in how to configure it
var sdk = new AWS.SQS()

var sqs = require('sqs-aws-sdk')

var queue = sqs(sdk)

// push some data to the test queue
queue.push('test', {
  some:'somedata'
})

// pull messages from the test queue
queue.pull('test', function(message, callback) {
  console.log('someone pushed', message)
  callback()  // we are done with this message - pull a new one
              // callbackling the callback will also delete the message
              // from the queue

  queue.stop() // stops the queue for receiving any other messages
})
```

## API

### sqs(sdk)


Create a queue instance

```js
var queue = sqs(sdk)
```

### queue.push(name, message, callback)

```js
queue.push(name, message)
```

Push a new message to the queue defined by name.

The queue needs to exits.


### queue.pull(name, [opts], onMessage)

Pull messages from the queue defined by name.

The pull flow is as follows:

1. A message is pulled and is passed to `onMessage(message, callback)`
2. You process the message
3. Call `callback` when you are done and the message will be deleted
   from the queue.
4. Goto 1

If for some reason the callback is not called amazon sqs will re-add the
message to the queue after 5 minutes.

The options include all the options accepted by the aws-sdk
[receiveMessage](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SQS.html#receiveMessage-property), plus:

* `wait`: the number of seconds to wait between every loop round
* `workers`: the number of calls to be done to SQS in parallel
* `raw`: if you do not want the message to be parsed as JSON

## Fault tolerance

Both `pull` and `push` will retry multiple times if a network error
occurs or if amazon sqs is temporary unavailable.

## Acknowledgements

This project was kindly sponsored by [nearForm](http://nearform.com).
It was extracted from [aws-autoscaling-container](http://npm.im/aws-autoscaling-container).

[@mafintosh](http://github.com/mafintosh) for its awesome
[sqs](http://npm.im/sqs) module. Part of the doc was borrowed from that
module, and also for the API contract.

[@Nss](http://github.com) for its work on the nScale
[aws-autoscaling-container](http://npm.im/aws-autoscaling-container).

## License

MIT

---
_Source: https://npm.io/package/sqs-aws-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
