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

http-rabbitmq-manager

v0.0.4

Published

RabbitMQ HTTP API client

Downloads

782

Readme

RabbitMQ HTTP API Client for Node

This library is a RabbitMQ HTTP API client for Node.js

Supported RabbitMQ Versions

  • RabbitMQ 3.x

All versions require RabbitMQ Management UI plugin to be installed and enabled.

Installation

npm install http-rabbitmq-manager

Documentation

Usage

Create a client instance

	var client = require('http-rabbitmq-manager').client({
		host : 'localhost',
    	port : 15672,
  		timeout : 25000,
        user : 'guest',
        password : 'guest'
	});

If any field is missing is used the default value from above

Overview

	client.overview(function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	client.getClusterName(function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	client.setClusterName({name : 'my_name@my_node'}, function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	// A list of extensions to the management plugin
	client.listExtensions(function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	//The server definitions - exchanges, queues, bindings, users, virtual hosts, permissions and parameters
	client.listDefinitions(function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	client.setDefinitions( {definition : 'my_definition'}, function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

Nodes

	// List all the nodes from cluster
	client.listNodes(function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	// Get statistics about an individual node
	// Optional memory : true to get memory statistics
	client.getNode({
		name : 'node_name',
		memory : true
	}, function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

Connections

	// A list of all open connections
	client.listConnections(function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	// Get statistics about an individual connection
	client.getConnection({
		connection : 'connection_name'
	}, function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	// Close a connection
	client.closeConnection({
		connection : 'connection_name'
	}, function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

Channels & Consumers

	/* Use empty object for all open channels,
       vhost for all open channels in a specific vhost and connection for all channels for a given connection.
       Vhost property and connection property cannot be used in the same time.
    */
	client.listChannels({
		vhost : 'vhost_name',
		connection : 'connection_name'
    }, function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	client.getChannel({
		channel : channel
    }, function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	/* 
	   Use empty object for all consumers,
       vhost for all consumers in a given virtual host.
    */
	client.listConsumers({
		vhost : 'vhost_name',
    }, function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

Exchanges

	/* 
	   Use empty object for all exchanges,
       vhost for all exchanges in a given virtual host.
    */
	client.listExchanges({
		vhost : 'vhost_name'
	}, function  (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	// Get statistics about an individual exchange. Vhost is mandatory
	client.getExchange({
		vhost : 'vhost_name',
		exchange : 'exchange_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	// Create an exchange. The vhost, exchange and type key are mandatory; other keys are optional.
	client.createExchange({
		vhost : 'vhost_name',
		exchange : 'exchange_name',
		type : 'direct',
		auto_delete : false,
		durable : true,
		internal : false,
		arguments : {}
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	// Delete an exchange
	client.deleteExchange({
		vhost : 'vhost_name',
		exchange : 'exchange_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	//Publish message to exchange
	//TO DO

Bindings

	/* 
	   Use empty object for all bindings,
       vhost for all bindings in a given virtual host.
    */
	client.listBindings({
		vhost : 'vhost_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	// A list of all bindings on a given queue.
	client.getQueueBindings({
		vhost : 'vhost_name',
		queue : 'queue_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	//A list of all bindings in which a given exchange is the source.
	client.getBindingsForSource({
		vhost : 'vhost_name',
		exchange : 'exchange_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	//A list of all bindings in which a given exchange is the destination.
	client.getBindingsForDestination({
		vhost : 'vhost_name',
		exchange : 'exchange_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

Queues

	/* 
	   Use empty object for all queues,
       vhost for all queues in a given virtual host.
    */
	client.listQueues({
		vhost : 'vhost_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	//An individual queue
	client.getQueue({
		vhost : 'vhost_name',
		queue : 'queue_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	//Create a queue. Vhost and queue name are mandatory, the rest of keys are optional
	client.createQueue({
		vhost : 'vhost_name',
		queue : 'queue_name',
		auto_delete : false,
		durable : true,
		arguments : {},
		node : rabbit@smacmullen
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	//Delete a queue
	client.deleteQueue({
		vhost : 'vhost_name',
		queue : 'queue_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	//Purge a queue
	client.purgeQueue({
		vhost : 'vhost_name',
		queue : 'queue_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	//Take action to queue. Currently the actions which are supported are sync and cancel_sync.
	client.setQueueActions({
		vhost : 'vhost_name',
		queue : 'queue_name',
		action : 'sync'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	//Get messages from a queue. Truncate is optional; all other keys are mandatory.
	client.getMessages({
		vhost : 'vhost_name',
		queue : 'queue_name',
		count : 5,
		requeue : true,
		encoding : "auto",
		truncate : 50000
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

Vhosts

	/* 
	   Use empty object for all vhosts,
       vhost for certain vhost
    */
	client.listVhosts({
		vhost : 'vhost_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	// Delete a vhost
	client.deleteVhost({
		vhost : 'vhost_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	// Create a vhost
	client.createVhost({
		vhost : 'vhost_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});

	//Get permissions for a vhost
	client.getVhostPermissions({
		vhost : 'vhost_name'
	}, function (err, res) {
		if (err) {
			console.log(err);
		} else {
			console.log(res);
		}
	});