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

squiss-ts

v5.4.0

Published

High-volume SQS poller

Downloads

7,839

Readme

Npm Version node Build Status Test Coverage Maintainability Known Vulnerabilities

Squiss-TS

High-volume Amazon SQS Poller and single-queue client for Node.js 16 and up with full typescript support
The library is production ready and is being stress used in a full blown production environment

Main features

  • Control how many messages can be handled at any given point
  • Efficiently auto pull new messages when concurrency is not fully utilized
  • Easy message lifecycle management
  • Options to auto renew messages visibility timeout for long message processing
  • Option to automatically gzip incoming and outgoing messages (based on message size) to decrease message sizes and save SQS costs
  • Option to auto upload large messages to s3 and retrieve the message from s3 upon receive, in order to decrease message sizes, save SQS costs and be able to send messages bigger than SQS size limit
  • Full typescript support

Documentation

Please see full documentation here

Quick example

import {Squiss, Message} from 'squiss-ts';

const awsConfig = {
  credentials: {
    accessKeyId: 'accessKeyId',
    secretAccessKey: 'secretAccessKey',
  },
  region: '<region>',
};

const squiss = new Squiss({
  awsConfig,
  queueName: 'my-sqs-queue',
  bodyFormat: 'json',
  maxInFlight: 15
});

squiss.on('message', (message: Message) => {
  console.log(`${message.body.name} says: ${JSON.stringify(message.body.message)} and has attripute p1 with value ${message.attributes.p1}`);
  message.del();
});

squiss.start();

const messageToSend = {
    name: 'messageName',
    message: {
        a: 1,
        b: 2,
    },
};

const propsToSend = {
    p1: 1,
    p2: 2,
};

squiss.sendMessage(messageToSend, 0, propsToSend);

Install

npm install squiss-ts

How it works

Squiss processes as many messages simultaneously as possible.
Set the maxInFlight option to the number of messages your app can handle at one time without choking, and Squiss will keep that many messages flowing through your app, grabbing more as you mark each message as handled or ready for deletion.
If the queue is empty, Squiss will maintain an open connection to SQS, waiting for any messages that appear in real time.
Squiss can also handle renewing the visibility timeout for your messages until you handle the message, or message handling time (set up by you) has passed (see autoExtendTimeout).
Bonus: Squiss will also automatically handle the message attributes formatting and parsing when receiving and sending messages.

Versions

Squiss supports Node 6 LTS and higher.

Credits

This project is a typescript port (with better performance, bug fixes and new features) of the wonderful and unmaintnaed project TomFrost/Squiss
Squiss was originally created at TechnologyAdvice in Nashville, TN.

Contributing

All contributions are happily welcomed!
Please make all pull requests to the master branch from your fork and ensure tests pass locally.