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

cqi-core

v0.4.1

Published

Common Queue Interface inspired by CGI.

Downloads

4

Readme

CQI stands for Common Queue Interface, inspired by CGI.

CQI is a simple and extensible framework to develop queue worker application. It listens message from a queue, and dispatch the messages to an another process through the standard I/O.

The following code listens SQS queue, and executes application.sh for each message. application.sh inputs message body via STDIN, and return the exit code 0 if succeeded.

import { CQI } from '../src/index'

const cqi = CQI.instance
const listener = CQI.factory.listeners.create('sqs', {
  region: 'your-region-1', // Your region
  queueUrl: 'https://sqs.your-region-1.amazonaws.com/ACCOUNT/QUEUE', // Your queueu URL
})

const dispatcher = CQI.factory.dispatchers.create('exec', {
  programFilePath: 'application.sh'
})

cqi.runDefaultContainer(listener, dispatcher)

Component Types

Listener

Listener receive messages from a queue, and passes them to the dispatcher.

  • array Listener to dispatch smessages as string array. (for debugging)
  • repl Listener to dispatch message input from console. (for debugging)
  • sqs Amazon SQS listener.

Dispatcher

Dispatcher passes a queue message from listener to the processer, and decide if successfully consumed.

  • EchoDispatcher Only echo the message.
  • ExecDispatcher CGI style. Starting a new process for each message.
  • StdioDispather Server style. Single process receives messages as lines from STDIN.

ExecDispatcher starts new process for each message, and writes the JSON to STDIN. If the exit status is 0, the message processed successfully.

StdioDispather starts a new process at first, and write each message as a JSON line to STDIN. The process outputs blank line if successfully consumed. Not blank line assumed an error message.

Container

Container joins listener and dispather. There is only one Container.