npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sqs-aws-sdk

v1.0.0

Published

Push and pull from SQS using the AWS SDK

Downloads

10

Readme

sqs-aws-sdk  Build Status

A message queue using Amazon Simple Queue Service using the AWS SDK. This module has the same interface of sqs, but uses the AWS SDK instead of a custom API wrapper.

Install

npm install sqs-aws-sdk

Usage

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

var queue = sqs(sdk)

queue.push(name, message, callback)

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, 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. It was extracted from aws-autoscaling-container.

@mafintosh for its awesome sqs module. Part of the doc was borrowed from that module, and also for the API contract.

@Nss for its work on the nScale aws-autoscaling-container.

License

MIT