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

aws-sqs-poll

v1.2.0

Published

Polling messages from AWS SQS

Downloads

116

Readme

aws-sqs-poll CI

Polling messages from AWS SQS

Note on long polling

Long polling helps reduce your cost of using Amazon SQS by reducing the number of empty responses (when there are no messages available to return in reply to a ReceiveMessage request sent to an Amazon SQS queue) and eliminating false empty responses (when messages are available in the queue but aren't included in the response):

See here for more information.

Install

$ npm install --save aws-sqs-poll

Usage

const awsSqsPoll = require('aws-sqs-poll');

awsSqsPoll('QueueName')
    //  ["MessageId": "28f61fd2-b9ca-4cb9-879a-71ea8bce4636",
    //   "ReceiptHandle": "AQEB9mnsxtAZlwnDERxn3yADAP96QRe0KPbqaKXLvvchqmD4jAr",
    //   "MD5OfBody": "098f6bcd4621d373cade4e832627b4f6",
    //   "Body": "test"]


awsSqsPoll('QueueName', {AwsAccountId: '123456789012', numberOfMessages: 1, timeout: 20, json: false})
    //  ["MessageId": "28f61fd2-b9ca-4cb9-879a-71ea8bce4636",
    //   "ReceiptHandle": "AQEB9mnsxtAZlwnDERxn3yADAP96QRe0KPbqaKXLvvchqmD4jAr",
    //   "MD5OfBody": "098f6bcd4621d373cade4e832627b4f6",
    //   "Body": "test"]

API

aws-sqs-poll(queueName, [options])

queueName

Type: string

[options]

Type: object Optional

options.numberOfMessages

Type: number

Number of messages to be retrieved in 1 polling action. When polling a queue with few messages (< 1000 messages), you will get less messages then the numberOfMessages parameter.

options.timeout

Type: number

Timeout (polling time) to listen to the queue for new messages.

[options.awsAccountId]

Type: string Optional

AWS account ID of the account that created the queue.

[options.json]

Type: boolean Optional

Flag for converting the data back to JSON format

License

MIT © Simon Jang