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

bigqueue

v0.1.0

Published

A BigQueue module for node.js-based apps

Downloads

3

Readme

node-bigqueue

A BigQueue module for node.js-based apps

Installation

Install global & local dependencies.

$ [sudo] npm install -g coffee coffeegulp [docco]
$ npm install

Configuration

Module is self configured to point to a local instance of BigQueue. It uses the node-config module, so you should place your config files on ./config folder in order to change the defaults.

Configuration Defaults

These are the default configuration values. More information on how override it is available here.

---
bigqueue:
  # Base URL. You may place #{cluster} in this value to point
  # to specific BigQueue instances.
  baseUri: 'http://127.0.0.1:8081'

  producer:
    # Path to produce messages.
    postUri: '/messages'

    # Number of retries before failing.
    defaultRetries: 3

    # Timeout between fails.
    defaultTimeout: 1000

  consumer:
    # Reading path.
    readUri: '/topics/#{topic}/consumers/#{consumer}/messages'

    # Acknowledgement path.
    ackUri: '/topics/#{topic}/consumers/#{consumer}/messages/#{recipient}'

    worker:
      # Time before start-up fetching messages.
      startDelay: 2000

      # Waiting time when the queue gets empty.
      sleepOnEmpty: 1000

      # Waiting time when fetching fails.
      sleepOnError: 2000

  client:
    # Time module users has to process a message before timing out
    # without acknowledgment.
    processTimeout: 500

  logger:
    # Enable log messages.
    enabled: true

Running Tests

$ npm test

Gulp Tasks

$ coffeegulp [task = default]
    lint     -- run lint checks
    test     -- run tests
    coffee   -- compile scripts into .js
    default  -- perform all tasks above
    docco    -- generate docs

Usage

{Consumer, Producer} = require 'bigqueue'

Sending a Message

# Create Producer, with max_retries, timeout.
producer = new Producer 3, 2000

# Send 'hello world!' message.
producer.send 'cluster', ['test_topic', 'another'], 'hello world!'
.then(
  (value) ->
    console.log "message sent: #{JSON.stringify(value)}"
  (error) ->
    console.log "message failed: #{error}"
)

Fetching Messages

consumer = new Consumer 'cluster', 'test_consumer',
  ['test_topic', 'another']

consumer.on 'start', (consumer) ->
  console.log "we're up and running!"

consumer.on 'stop', (consumer) ->
  console.log 'stop!'

# Don't forget to notify Consumer whether we've been able to process the
# message or not!
consumer.on 'message', (message, ack) ->
  console.log "got a message!: #{JSON.stringify(message)}"

  # Process the message. We shouldn't take much time in here, otherwise we may
  # timeout.
  db.save message, (error) ->
    ack(error)

consumer.on 'ack', (message) ->
  console.log "message acknowledged!: #{message.recipientCallback}"

consumer.on 'uptodate', (consumer) ->
  console.log "we're up to date!"

# Start consuming events.
consumer.start()