How to run RabbitMQ’s experimental STOMP adapter

By: on February 2, 2008

The code for the experimental STOMP adapter for RabbitMQ is distributed separately from the main server, at the moment. This post walks through the steps needed to try the adapter out, running it against a recent snapshot release of RabbitMQ. The perl Net::Stomp STOMP client is used to demonstrate the adapter in action, subscribing to a queue and sending a couple of messages to it.

You will need:

* Erlang R11B-5 installed, with erl and erlc on your path
* GNU Make
* A recent snapshot of RabbitMQ. For this example, I used [old link: ].
* A recent snapshot of the RabbitMQ STOMP adapter. An up-to-the-minute snapshot is available here (generated on-the-fly from a mercurial repository).

and, optionally, Perl to run the Net::Stomp example (or you could write your own examples using any other STOMP client, of course!); my Mac laptop comes with perl 5.8.8.

The first step is to unpack and compile the RabbitMQ server.

$ tar -zxvf rabbitmq-200801150657.tar.gz
$ cd rabbitmq-200801150657/erlang/rabbit/
$ make
$ cd ../../..

Once that’s done, fetch and extract the latest RabbitMQ STOMP adapter.

$ curl 
    | tar -jxvf -

Each time a commit is made to the STOMP adapter’s mercurial repository, the hexadecimal revision identifier changes, so the directory created by the unpacking of the snapshot you retrieve will be different. At the time of writing, the STOMP adapter’s directory was rabbitmq-stomp-7b00398dd81f.

To compile the STOMP adapter, you need to point make at the location of the RabbitMQ server codebase you’ve just compiled:

$ cd rabbitmq-stomp-7b00398dd81f/
$ make RABBIT_SOURCE_ROOT=../rabbitmq-200801150657

If you’ve managed to get through all those steps successfully, it’s time to try running the server. Issue the following “make run” command from the rabbitmq-stomp-7b00398dd81f directory:

$ make RABBIT_SOURCE_ROOT=../rabbitmq-200801150657 run
make -C ../rabbitmq-200801150657/erlang/rabbit run 
                RABBIT_ARGS='-pa '"$(pwd)/ebin"' -rabbit 
                        stomp_listeners [{"",61613}] 
                        extra_startup_steps [{"STOMP-listeners",rabbit_stomp,kickstart,[]}]'
NODE_IP_ADDRESS= NODE_PORT= NODE_ONLY=true LOG_BASE=/tmp  RABBIT_ARGS="-pa /Users/tonyg/dev/AMQ/scratch/rabbitmq-stomp-7b00398dd81f/ebin -rabbit                stomp_listeners [{"",61613}]           extra_startup_steps [{"STOMP-listeners",rabbit_stomp,kickstart,[]}] -s rabbit" MNESIA_DIR=/tmp/rabbitmq-rabbit-mnesia ./scripts/rabbitmq-server
Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:30] [kernel-poll:true]

Eshell V5.5.5  (abort with ^G)
(rabbit@walk)1> RabbitMQ 200801150657 (AMQP 8-0)
Copyright (C) 2007 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
Licensed under the MPL.  See

Logging to "/tmp/rabbit.log"
SASL logging to "/tmp/rabbit-sasl.log"

starting database             ...done
starting core processes       ...done
starting recovery             ...done
starting persister            ...done
starting builtin applications ...done
starting TCP listeners        ...done
starting STOMP-listeners      ...done

broker running

Now, let’s try it out. I’ll use the Perl Net::Stomp module, available on CPAN.

$ sudo cpan -i Net::Stomp

The examples I’m going to try out are those from the Net::Stomp documentation – run perldoc Net::Stomp to read the originals. Save the following code into

# send a message to the queue 'foo'
use Net::Stomp;
my $stomp = Net::Stomp->new({hostname=>'localhost', port=>'61613'});
$stomp->connect({login=>'guest', passcode=>'guest'});
$stomp->send({destination=>'foo', body=>($ARGV[0] or 'test message')});

and the following code into

# subscribe to messages from the queue 'foo'
use Net::Stomp;
my $stomp = Net::Stomp->new({hostname=>'localhost', port=>'61613'});
$stomp->connect({login=>'guest', passcode=>'guest'});
$stomp->subscribe({'destination'=>'foo', 'ack'=>'client'});
while (1) {
    my $frame = $stomp->receive_frame;
    print $frame->body . "n";
    last if $frame->body eq 'QUIT';

Run the receiver before the sender to make sure the queue exists at the moment the send takes place. In one terminal window, start the receiver:

$ perl ./

In another terminal window, run the sender:

$ perl ./
$ perl ./ "hello world"
$ perl ./ QUIT

The receiver’s window should contain the received messages:

$ perl ./ 
test message


  1. Carl Bourne says:

    Does this currently support SSL/TLS?

  2. Hi,
    I’m interested in trying out the rabbitmq-stomp server to provide server support for a Flash-based chat client that I am working on, but I’m having trouble getting started.

    I tried to follow your step-by-step instructions on WindowsXP, but came across several stumbling blocks. The version of rabbitmq-stomp that is currently available (rabbitmq-stomp-b01c04778288) does not seem to be compatible with the rabbitmq server any more. When the “make … run” command is issued (under cygwin bash or the dos shell), I get shell syntax errors:
    $ make RABBITSOURCEROOT=../rabbitmq-200801150657 run
    c:/Program Files/GNU/make -C ../rabbitmq-200801150657/erlang/rabbit run
    RABBITARGS=’-pa ‘”$(pwd)/ebin”‘ -rabbit
    listeners [{“”,61613}]
    extrastartupsteps [{“STOMP-listeners”,rabbitstomp,kickstart,[]}]’
    /usr/bin/sh: -c: line 1: syntax error near unexpected token (' /usr/bin/sh: -c: line 1: RABBIT
    ARGS=’-pa ‘$(pwd)/ebin’ -rabbit ‘
    make: *** [start_server] Error 2

    What shell should I use to execute ‘make … run’ in?

    If I manually create that run command, I get runtime errors too:
    $ cd ../rabbitmq-200801150657/erlang/rabbit
    $ make run RABBITARGS=’-pa ./ebin -rabbit
    listeners [{“”,61613}]
    extrastartupsteps [{“STOMP-listeners”,rabbit_stomp,kickstart,[]}]’

    stomplisteners [{“”,61613}]
    startupsteps [{“STOMP-listeners”,rabbitstomp,kickstart,[]}] -s rabbit” MNESIADIR=/tmp/rabbitmq-rabbit-mnesia ./scripts/rabbitmq-server
    kernel-poll not supported; “K” parameter ignored
    Eshell V5.5.5 (abort with ^G)
    (rabbit@henry-mac)1> {“init terminating in do

    Crash dump was written to: erlcrash.dump
    init terminating in do
    boot ()
    make: *** [run] Error 1

    Any ideas why trying to run the rabbitmq server with Stomp is crashing? Any help would be much appreciated!

  3. tonyg says:

    @Carl: Not explicitly. You could, of course, turn on SSL in whatever client library you use and use stunnel4 on the server-side to wrap the STOMP adapter.

  4. tonyg says:

    @Henry: Sorry about that. The STOMP adapter isn’t presently an official part of RabbitMQ, and I’ve not had an opportunity to update it to work with RabbitMQ 1.3. It should work with the specific snapshots mentioned in the post.

    The shell I usually use is bash. With regard to the crash-on-manual run, it looks like it’s failing to be able to write to /tmp. If you’re using cygwin, chances are this is because of a disconnect between the Unix mode and the Windows mode of the system. Try setting LOG_BASE to something other than /tmp.

  5. Carl Bourne says:

    Hi I’ve been doing some testing with the rabbitmq-200803291005 snapshot and the Ruby Stomp library.

    I have test sender:

    require ‘rubygems’
    require ‘stomp’

    client =“guest”, “guest”, “”, 61613)
    10000.times { |i| client.send ‘carl’, “Test Message number #{i}”}
    client.send ‘carl’, “All Done!”

    A test receiver:

    require ‘rubygems’
    require ‘stomp’

    conn =‘guest’, ‘guest’, ‘’)
    while true
    mesg = conn.receive

    puts mesg if mesg

    puts mesg.body if mesg
    sleep 0.0001

    However it seems that every third batch of 10000 messages I send, the receiver (or maybe its the sender) drops the last 10-20 messages. I’ve tested this on Ubuntu and MAC OSX.

    Any Idea what could cause this?

    Also, when will the stomp adapter be included in the official RabbitMQ distribution? or better still will there be a native AMQP library for Ruby?

    Best Regards,


  6. tonyg says:

    Carl, thank you for your comment – you have discovered a bug in the STOMP adapter. I’ll update here and on the mailing-list when we have a fix. Regards, Tony

  7. Ronen says:

    I’m using the STOMP adapter for RabbitMQ (v1.5.1) and the Python module It connects fine, but as soon as I try to
    subscribe or send a message I get an error message.
    $ ./rabbitmq-server RabbitMQ 1.5.1 (AMQP 8-0) : starting TCP listeners ...done starting STOMP-listeners ...done

    broker running
    As soon as I run the simple example at the top of this post I get:
    received an error {undef,[{rabbitchannel,startlink, [rabbitstomp,<0.160.0>,<0.160.0>,<<"guest">>, <<"/">>]}, {rabbitstomp,dologin,4}, {rabbitstomp,processframe,3}, {rabbitstomp,processreceivedbytes,2}, {rabbitstomp,init,1}, {proclib,initpdo_apply,3}]}
    The corresponding log lines are:
    =INFO REPORT==== 12-Feb-2009::09:58:42 === starting STOMP connection <0.160.0> from

    =ERROR REPORT==== 12-Feb-2009::09:58:42 === STOMP error frame sent: Message: "Processing error" Detail: "{undef,[{rabbitchannel,startlink,n [rabbitstomp,<0.160.0>,<0.160.0>,<<"guest">>,n <<"/">>]},n {rabbitstomp,dologin,4},n {rabbitstomp,processframe,3},n {rabbitstomp,processreceivedbytes,2},n {rabbitstomp,init,1},n {proclib,initpdo_apply,3}]}n"

    =INFO REPORT==== 12-Feb-2009::09:58:42 === ending STOMP connection <0.160.0> from
    Does anybody have an idea what’s wrong here? AMQP connections to this same
    server work just fine.

  8. tonyg says:

    Hi Ronen, you will need to use tag rabbitmq_v1_5_1 of the STOMP adapter with the 1.5.1 broker:

    (cd rabbitmq-stomp; hg up rabbitmq_v1_5_1; make)

    The internal APIs for channel setup changed between 1.5.1 and the tip-of-default.

  9. Sanjay says:

    I am getting this error when I start the perl receive script –

    Error reading command: at /usr/lib/perl5/site_perl/5.8.5/Net/Stomp/ line 37, line 5.

  10. tonyg says:

    Hi Sanjay, sorry to hear you’re having problems. The script works for me; I think I’ll need more to go on if I’m to help you. Please join the rabbitmq mailing list — see — and ask your question again there.

  11. nemanja says:


    I had the same error. Resolved it by using the tip versions from mercurial of both the rabbitmq-server and the STOMP adapter. Worked just fine after that.

  12. tonyg says:

    (@nemanja, @Sanjay: Specifically, use the default branch of both the server and STOMP adapter:

    hg clone
    hg clone
    hg clone
    make -C rabbitmq-server
    make -C rabbitmq-stomp run


  13. jesse says:

    I grabbed the latest server source and built it then cloned the stomp repository as a subdirectory of the server source directory.

    When I to try to make the stomp adapter with the command:

    Has anyone ran into this or have any idea what I am doing wrong?

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>