node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป


rabbit-pub-sub Build Status

A turn key solution for doing pub/sub using rabbitmq.

What is this?

This project was written to try and minimise the friction in getting going with rabbitmq when using a publication/subscription model.

How do I install it?

npm install

You can install this plugin via the node package manager. The --save option will automnatically insert a package entry into you package.json.

npm install rabbit-pub-sub --save

What about the code?

A simple pub sub scenario below. Please make sure you dispose of your connections properly or else they will leak!!

var util = require("util");
var rabbit = require("rabbit-pub-sub");

var logger = {
    info: function(str) {

var config = {
    server: "localhost",
    queue: "test-queue",
    exchange: "test-exchange"

var subscriber = new rabbit.MessageSubscriber(config, logger,
    function(message) {"Received message: " + util.inspect(message));
        //subscriber.end(); // Not doing this will leak connections!

new rabbit.MessagePublisher(config, logger, function(publisher) {
        name: "fir3pho3nixx",
        email: ""
    publisher.publish({ name: "any" });
    //publisher.end(); // Not doing this will leak connections!