fun with nodejs and rabbitmq

The long awaited server side javascript revolutions is alive and well!

Here is a quickstart for funning around with nodejs and rabbitmq

The copy-pasta is from my retro machine at the house running ubuntu 10 (Maverick), but there’s little ubuntu specific stuff…

install nodejs

 % git clone
 % cd node
 % sudo apt-get install g++ libssl-dev
 % ./configure && make && sudo make install
 % echo 'console.log( "go node!" )'  | node

install npm

As per the website, you can run the install script from curl.

Oddly enuff, to avoid running it as root, buddy suggests making your user own all of /usr/local.

Instead, I thought I’d add an npm user and setuid the npm stuff:

 % sudo adduser --gid 0 npm
 % sudo chmod g+w /usr/local/lib 
 % sudo chmod g+w /usr/local/share/man 
 % sudo chmod g+w /usr/local/bin 
 % sudo chmod g+w /usr/local/man/man1
 % sudo su npm
 % cd /tmp
 % git clone
 % cd npm
 % ./configure
 % make && make install 
I tried setting 4755 on /usr/local/lib/node_modules/npm/bin/npm.js, but it complains when I tried to install some stuff..

Just have to use the npm user to install node-amqp:

 % sudo su npm -c "npm install -g amqp"
 % cd 
 % ln -s /usr/local/lib/node_modules

install rabbitmq

The out of the box rabbit for ubu10 was ancient bullshit!

The rabbitmq guys have some tips… basically:

 % echo deb testing main | sudo tee -a /etc/apt/sources.list
 % wget
 % sudo apt-key add rabbitmq-signing-key-public.asc
 % sudo apt-get update
 % sudo apt-get install rabbitmq-server

It gets cranked up at install and there is a handy init script:

 % sudo /etc/init.d/rabbitmq-server status

a simple demo

So… this code runs fine on my mac, but is weirdly busted on my olde ubuntu box:

clear ; ./amqp-dee-dum.js
got the exchange
[hilarity ensues: try it out!]

I had to create new exchange named ‘tmp’, it wouldn’t let me use ‘’ for some reason…


I think the code is pretty ez to follow if sorta copy-pasta heavy.

I hope to do a refactored version at some point…

what happened with the old rabbit

ouch: Oversized frame 1342243080
FATAL ERROR: v8::Object::SetIndexedPropertiesToExternalArrayData() length exceeds max acceptable value

Using the non-crusty version everything worked fine.



  1. I just spent an hour debugging this exact issue – turns out, my Ubuntu server was running an old version of RabbitMQ Client which expects version ~0.8 of AMQP, and node-amqp expects version ~0.9

    In short, add the RabbitMQ repos to your apt sources then apt-get upgrade / update

  2. brianin3d said

    Nice! I finally did get around to this… Updated the post…

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: