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 🙏

© 2025 – Pkg Stats / Ryan Hefner

node-redis-queue-demos

v0.0.9

Published

Examples of how to use node-redis-queue.

Readme

node-redis-queue-demos

Examples of how to use node-redis-queue.

##Install the source code

  1. Run git clone https://github.com/cwjohan/node-redis-queue-demos.git to get a copy of the source code.
  2. Run npm install to get the dependencies.

##Running the demos -- preliminary steps

  1. Open two Git Bash console windows.
  2. If redis-server is not already running, open an additional console window and run redis-server or redis-server & to start the Redis server in the background. The demos assume default login, no password.

##Running demo 01 -- Channel example

This demo shows how to send a series of URLs to a consumer process that computes an SHA1 value for each URL.

  1. In the first console window Run node worker01.js. It will wait for some data to appear in the queue.
  2. In the second console window, run node provider01.js, which will place four URLs in the queue. Shortly thereafter, the worker01 process will pick up the four URLs and display them, fetch a page body for each, and compute an SHA1 value for each.
  3. Repeat step 2 a few times.
  4. In the second console window, run node provider01.js stop, which will put a stop command in the queue. Shortly thereafter, the worker01 process will stop.

##Running demo 02 -- Channel example

This demo shows how to send a series of URLs to a consumer process that computes an SHA1 value for each URL and returns the SHA1 result to the provider process.

  1. In the first console window Run node worker02.js. It will wait for some data to appear in the queue.
  2. In the second console window, run node provider02.js 01, which will place four URLs in the queue. Shortly thereafter, the worker02 process will pick up the four URLs, display them, fetch a page body for each, and compute an SHA1 value for each, and then return the SHA1 result to the provider02 instance, which will display the result.
  3. Repeat step 2 a few times.
  4. In the second console window, run node provider02.js stop, which will put a stop command in the queue. Shortly thereafter, the worker02 process will stop.

##Running demo 03 -- WorkQueueMgr example

This demo shows how a worker can service multiple queues using WorkQueueMgr. The provider process, by default, sends three strings to one queue and three strings to the other.

  1. In the first console window Run node worker03.js. It will wait for some data to appear in the queue.
  2. In the second console window, run node provider03.js, which will place three strings in each queue. Shortly thereafter, the worker03 process will pick up the six strings from their respective queues and display them.
  3. Repeat step 2 a few times.
  4. In the second console window, run node provider03.js stop, which will put a stop command in the queue. Shortly thereafter, the worker03 process will stop.

##Running demo 04 -- WorkQueueMgr example

This demo is almost the same as demo 02 but uses WorkQueueMgr rather than Channel. It shows how to send a series of URLs to a consumer process that computes an SHA1 value for each URL and returns the SHA1 result to the provider process.

  1. In the first console window Run node worker04.js. It will wait for some data to appear in the queue.
  2. In the second console window, run node provider04.js 01, which will place four URLs in the queue. Shortly thereafter, the worker04 process will pick up the four URLs, display them, fetch a page body for each, and compute an SHA1 value for each, and then return the SHA1 result to the provider04 instance, which will display the result.
  3. Repeat step 2 a few times.
  4. In the second console window, run node provider04.js stop, which will put a stop command in the queue. Shortly thereafter, the worker04 process will stop.

To check out the arity feature, try the above again using node worker04.js 3 in step 1. Observe that the worker will process three input requests in parallel and that the results may become available in a different order than the input requests.

To check out the timeout feature, try the above yet again using node worker04.js 1 1. Observe the timeout messages emitted about once every second.

##Running Coffee

If you make any changes to the .coffee source code, you will want to convert the .coffee files into .js files. To do so, run:

npm run coffee