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

nibi

v1.1.2

Published

Extremely easy management of queues with RabbitMQ and/or AmazonSQS

Downloads

12

Readme

OFF-SQS: Manage Amazon SQS and RabbitMQ on node.js

This easy manager provides the basic functionality to use Amazon SQS in production enviroment and RabbitMQ in development enviroment. To start using it just clone it or install it via npm npm install off-sqs-debearloper.

Amazon SQS settings

You need to add yours AWS keys in a JSON file, something like this:

    {
        "accessKeyId": "STRING",
        "secretAccessKey": "STRING",
        "region": "STRING"
    }

Note: that every operation checks first if the Queue exists, if not it'll create it.**

RabbitMQ settings

To work with RabbitMQ, you need to install the Server. We recommend you to do it with homebrew, so you dont have to set up the server manually when you are in the development environment.

Before installing make sure you have the latest brews: brew update

Then, install RabbitMQ server with:

brew install rabbitmq

Enviroments

development is the enviroment by default. If you want to use production or qa execute your node app in this way:

NODE_ENV=production node yourApp.js
//or
NODE_ENV=qa node yourApp.js

Methods

Import and declare

var Nibi = require('nibi');
var nibi = new Nibi();

Configure

  • Params: an object with the configure params.
  • Returns: nothing.

if you want to use AmazonSQS with this modul, you need make this

//require your own aws json file
var myAwsConfigFile = require('./myAwsConfigFile');

nibi.configure({
  awsConfigFile: myAwsConfigFile
});

Sender()

  • Params: the name of the SQS queue and the data you want to send.
  • Returns: nothing.

Usage:

offSqs.sender('myQueueName', ["foo": "bar"]);

##Receiver()

  • Params: the name of the SQS queue.
  • Return: A promise which will become a tuple of receiver a function and queueUrl a string.

Usage:

   offSqs.receiver('myQueue', yourDataManager);

Note: Where yourDataManager is a function that receives every message on the queue, so you can easyly customize your data miner. Something like: `myMiner(messageOfTheQueue);``

###Example

    var printData = function(data){
       console.log(data)
    }

    offSqs.receiver("queueName", printData)

##getQueueUrl()

  • Params: The name of the SQS Queue.
  • Returns: A promise, which will become the url of the Queue.

Usage:

    offSqs.getQueueUrl('myQueue').then(function('myQueueURL'){
    	return myQueueURL;
    });

##parseMessage()

  • Params: Data received by SQS Queues.
  • Returns: The cleaned data of the body as array.

Usage:

offSqs.parseMessage(data);