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 🙏

© 2026 – Pkg Stats / Ryan Hefner

softlayer-messsage-queue

v1.0.0

Published

Message queue client for Softlayer, an IBM Company.

Readme

Softlayer Message Queue API Module for Node.js

**NOTE:**This is not official release from Softlayer, an IBM Company. Use this module at your own risk. Owner is not responsible for any kind of damage. Please refer http://sldn.softlayer.com/reference/messagequeueapi for more details.

To use this library you need a Softlayer message queue credential details, Which contain Account ID, User name & API key.The client has the following features:

Queue

  • Creates a new queue
  • Pushes a message to a queue
  • Pops messages from a queue
  • Get details of a queue
  • Lists all queues
  • Deletes a message from a queue
  • Deletes a queue

Topic

  • Creates a new topic
  • Adds a subscription to a topic
  • Pushes a message to a topic
  • Lists all topics
  • Get details of a topic
  • Lists subscriptions on a topic
  • Deletes a subscription
  • Deletes a topic

Account

  • Authenticate and receive an auth token
  • Show Requests/Notifications made for the current account

Other

  • Ping the service

Installation

$ npm install softlayer-message-queue

Usages

Creates a new Client

var mq = require('softlayer-message-queue');

//Create a new client using accountID, UserName & API Key 
var client = new mq.MessageClient(<accountID>, <UserName>, <API Key>);

//Set Datacenter to Get Endpoint. Please pass 'true' to get private endpoint url and 'false' to use public url.
client.SetDataCenter(mq.DataCenterEndpoint.DAL05,false);

After creating a client you have to call client.Authenticate() to authenticate the client, it will provide a API Token and this API token will be used in consecutive call.

Creates a new queue

var queue = new mq.Queue("testQueue1",100,5000,["testTags"]);

client.CreateQueue(queue,function(statusCode,result)
	{
		console.log(statusCode);
		console.log(result);
	});

Pushes a message to a queue

var message  = new mq.Message("<body>",{"field": "value"},1000,30000);

client.PushMessage("testQueue1",message, function (statusCode,result) 
	{
        console.log(statusCode);
        console.log(result);
    })

Pops messages from a queue

client.PopMessage("testQueue1",1, function (statusCode,result) 
	 {
	     console.log(statusCode);
	     console.log(result);
     })

Get details of a queue

client.GetQueue("testQueue1",function(statusCode,queueDetails)
	 {
     	console.log(queueDetails)
     });

Lists all queues

client.GetQueueList(function(statusCode,queueList)
	{
        console.log(queueList)
    })

Lists all queues By Tag

client.GetQueueListByTag("tag2,testTags",function(statusCode,result)
	{
        console.log(result)
    })

Deletes a message from a queue

client.DeleteMessage("testQueue1","f3f2ebacfbd3b67a430943972c4966eb", function (statusCode,result) 
	{
	     console.log(statusCode);
	     console.log(result);
	})

Modify a queue

 client.GetQueue("testQueue1",function(statusCode,queueDetails){
         queueDetails.visibility_interval = 123;
         queueDetails.expiration = 321;
         queueDetails.tags.push('tag5');
         queueDetails.tags.pop();

client.ModifyQueue(queueDetails,function(statusCode,result){
         console.log(statusCode);
         console.log(result);
         });
     })

Deletes a queue

client.DeleteQueue("testQueue1",true,function(statusCode,result)
	 {
	     console.log(statusCode);
	     console.log(result);
     })

Creates a new topic

var topic  = new mq.Topic('example_topic',["tag1", "tag2", "tag3"])

client.CreateTopic(topic, function (statusCode, result){
        console.log(statusCode);
        console.log(result);
    })

Adds a subscription to a topic

//For Http Topic Subscription

var httpTopicSubscription = new mq.HttpTopicSubscription(mq.
HttpTopicSubscriptionMethod.Get,"url","param","headers","body");

client.CreateTopicSubscription("example_topic", httpTopicSubscription,function (statusCode, result) {
        console.log(JSON.stringify(result));
    })

//For Queue Topic Subscription

var queueTopicSubscription = new mq.QueueTopicSubscription("test_Queue");

client.CreateTopicSubscription("example_topic_queue", queueTopicSubscription,function (statusCode, result) {
        console.log(JSON.stringify(result));
    })

Pushes a message to a topic

var message  = new mq.Message("<body>",{"field": "value"},1000,30000);

client.PublishToTopic("example_topic", message,function (statusCode, result) {
        console.log(JSON.stringify(result));
    })

Lists all topics


client.GetTopicList(function (statusCode, result) {
        console.log(statusCode);
        console.log(result);
    })

Lists all topics By Tag

client.GetTopicListByTag("tag2,testTags",function (statusCode, result) {
        console.log(statusCode);
        console.log(result);
    })

Get details of a topic


client.GetTopic("example_topic",function (statusCode, result) {
        console.log(statusCode);
        console.log(result);
    })

Lists subscriptions on a topic


client.GetTopicSubscriptionList(("example_topic",function (statusCode, result) {
    console.log(statusCode);
    console.log(result);
})

Deletes a subscription


client.DeleteTopicSubscription(("example_topic","subscriptionID",function (statusCode, result) {
        console.log(statusCode);
        console.log(result);
    })

Modify a topic

client.GetTopic("testQueue1",function(statusCode,topicDetails){
        topicDetails.tags.pop()

client.ModifyTopic(topicDetails,function(statusCode,result){
            console.log(statusCode);
            console.log(result);
        });
    })

Deletes a topic

client.DeleteTopic("testQueue1",true,function(statusCode,topicDetails){
            console.log(statusCode);
            console.log(result);
        });

Authenticate and receive an auth token

client.Authenticate(function(statusCode,accessToken)
	{
		console.log(statusCode);
        console.log(result);
    })

Show Requests/Notifications made for the current account

Available AccountStatsDurationType : Past_Hour,Past_Day,Past_Week,Past_Month

client.GetAccountStatistics(mq.AccountStatsDurationType.Past_Hour,function(statusCode,result)
	{
        console.log(JSON.stringify(result));
    })

Ping the service

   
mq.Ping(function (statusCode, result)
    {
        console.log(statusCode);
        console.log(result);
    })

Error Handling

Every method returns HTTP StatusCode alongwith data. so you can easily use statusCode to handle the error.