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

etzelclient

v0.1.8

Published

A client library that allows you to connect to the etzel queue server

Downloads

5

Readme

#Nodejs & javascript client for Etzel server:-

You can install the node client by opening a command prompt and using the following command

npm install etzelclient

then include the library in your .js file:

require('etzelclient');

1. publish(queuename,message,options)

This pushes a message to etzel server.The arguments required are queuename (which is the name of the queue you want to pubish to), message (which is the message you want to publish to the queue),options includes delay and expire functionality . The options argument can be used when the message insert needs to be delayed or messaged validity needs to be expired. Options isn't an obligatory argument. The delay and expiry is taken in seconds.

Example:-

etzelclient=require("etzelclient");

ec=new etzelclient("ws://localhost:8080/connect");
ec.onopen=function(){
    ec.publish('test','hi');

}

test is the queuename,hi is the message and the delay is 0 seconds

additional options for publish:

    ec.publish('test','hi',{delay:5,expires:3600,priority:0});
  • delay: The item will not be available on the queue until this many seconds have passed. Default is 0 seconds. Maximum is 365 days(in seconds).

  • expires: How long in seconds to keep the item on the queue before it is deleted. Default is 0(365 days).

  • priority: It can be either -20,0,20 (High, Medium, Low).

2. subscribe(queuename,callback)

The subscribe function is fetches a message from the etzel server. The argument required are queuename which is the name of the you want to fetch the data from, callback is a custom fucntion which you have you provide.

Example:-

etzelclient=require("etzelclient");

ec=new etzelclient("ws://localhost:8080/connect");

//function which the end user writes
function mycallback(data){

    console.log(data.msg+" from the queue");
    ec.acknowledge("test",data.uid);

}
ec.onopen=function(){
    ec.subscribe("test",mycallback);
}

Here test is the queuename. An entity fetching data from the specific queue is called a worker. You can multiple workers working on the same queue. The server facilitates load balancing amongst the workers. Fetching a message will delete the message from the queue temporarily(re-queued after 60 seconds).

acknowledge(queuename,uid)

To delete it permanently , we use the acknowledge function which deletes/acknowledges a specific message from the queue. The arguments required are queuename and the id of the message you want to acknowledge.

Responses received from the queue are as follows:-

The responses received are all in standard json format.

No Queue Found:-

{
    "cmd":"nok",
    "err": "Q_NOT_FOUND"
}
```

#### No Message Available in the requested Queue:-

{ "cmd":"nomsg", "qname": "$Q_NAME" }


#### Server says it is OK to go to sleep

{ "cmd":"okslp", "qname": "$Q_NAME" }


#### Message Available in the requested Queue:-

{ "cmd": "msg", "qname": "$Q_NAME", "uid": "$uid", "error_count": "$count", "msg": "$message" }


#### Queue is awake:-

{ "cmd":"awk", "qname": "$Q_NAME" }