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 🙏

© 2026 – Pkg Stats / Ryan Hefner

jobstream-queue-engine

v0.0.8

Published

Attempt at building a sample job stream

Readme

Jobstream Queue Engine

Overview

Jobstream Queue Engine is a wrapper around SQS. The goals of this project are to:

  1. Simplify the steps required for setting up asynchronous queue-based processing by abstracting away all of the boilerplate scaffolding and usage of the AWS SQS client SDK
  2. Provide an extremely simple interface for enqueueing and dequeueing messages to and from an AWS SQS queue, leaving your code clean and easy to reason about

Installation

Using npm:

$> npm install -s jobstream-queue-engine

Usage

In NodeJS:

  1. Create a class for each asynchronous processing job. See the async-workers folder of this repository for an example.
// Import the Jobstream class
import Jobstream from "jobstream-queue-engine";

// Create a class that extends Jobstream. It must include 2 methods:
//   1. `static configFilePath()` - Path to a YAML config file that includes the following keys:
//      * sqs_queue_name
//      * aws_region
//      * aws_account_id
//   2. `async perform({ message })` - Processing logic that the asynchronous job is intended
//      to carry out.
class SampleAsyncJob extends Jobstream {
  static configFilePath() {
    /*
     * The following keys are required in the config file:
     *   - sqs_queue_name (example: 'SampleQueueFifo')
     *   - aws_region (example: 'us-east-1')
     *   - aws_account_id (example: '123456789012')
     */
    return '/path/to/config.yaml';
  }

  async perform({ message }) {
    /*
     * Some set of steps to execute for processing the incoming message.
     *
     * --IMPORTANT--
     *  - A truthy return value will proceed to delete the message from SQS so that it is
     *     not re-enqueued.
     *  - A falsy return value will have SQS re-enqueue the message. AWS SQS will automatically
     *     re-enqueue messages up to the configured maxReceiveCount of the queue, or indefinitely
     *     if not configured.
     */
  }
}
  1. Create an instance of the class you just created using the static "create" method that is exposed by Jobstream
// The workerId argument is optional. When supplied, it appends the workerId to the job's logs.
// This is particularly useful in the likely scenario that you have multiple instances of the
// same type of job simultaenously processing messages.
const sampleRequestAsyncJob = await SampleRequestAsyncJob.create({ workerId: workerId });
  1. Enqueue a message using any instance
// Note: Messages are base64 encoded in transit. Encryption can be enabled on AWS for more
//  stringent security requirements.
const response = await sampleRequestAsyncJob.enqueue({
  message: {
    foo: 'bar',
  },
});
  1. Dequeue a message using any instance
// Note: The dequeue method will poll SQS for a message. If a message is received, it will then
//  be base64 decoded and supplied as the 'message' parameter in your class's
//  'perform({ message })' method.
const message = await sampleRequestAsyncJob.dequeue();

More Examples

For a complete example end-to-end, see this repo.

Future Development Plans

  • JSON-formatted config files
  • Support for message 'attributes' (different from the message 'body')
  • SQS queue setup and configuration via AWS Cloudformation
  • Integration with SNS and/or AWS Kinesis