STOMP adapter updated for RabbitMQ 1.3.0

April 30th, 2008 tonyg

I’ve updated our STOMP adapter for RabbitMQ to fix a bug reported by Carl Bourne. In the process, I updated the code to work with the latest snapshots of RabbitMQ, including the currently-released version, v1.3.0.

You can get the code by checking it out from our repository with

hg clone http://hg.opensource.lshift.net/rabbitmq-stomp/

or you can instead download a snapshot of the current state of the adapter[1], currently at revision 392d8cc8449c.

Here’s a summary of how to build and run a STOMP-enabled RabbitMQ broker - for more details, see the original post on the topic:

  1. First, retrieve the RabbitMQ server 1.3.0 source code, and unpack it:
    curl http://www.rabbitmq.com/releases/source/rabbitmq-1.3.0.tar.gz | tar -zxvf -

  2. Next, grab the latest STOMP adapter:
    curl http://hg.opensource.lshift.net/rabbitmq-stomp/archive/rabbitmq_v1_3_0_branch.tar.gz | tar -zxvf -

  3. Compile the server itself:
    make -C rabbitmq-1.3.0/erlang/rabbit

  4. Finally, compile the adapter, and start the server with extra options that cause the adapter to start too:
    make -C rabbitmq-stomp-rabbitmq_v1_3_0_branch run

If this is successful, you should end up with “starting STOMP-listeners …done” and “broker running” in your terminal. At this point you can try out the service - for instance, you can run Carl’s test cases if you have ruby and rubygems handy:

sudo apt-get install ruby
sudo apt-get install rubygems
sudo gem install stomp
ruby rabbitmq-stomp-rabbitmq_v1_3_0_branch/priv/tests-ruby/cb-receiver.rb

and in another window

ruby rabbitmq-stomp-rabbitmq_v1_3_0_branch/priv/tests-ruby/cb-sender.rb

It will transfer 10,000 short messages, and end up displaying

...
Test Message number 9998
Test Message number 9999
All Done!

in the receiver-side terminal.

If you’re interested in the gory details of the bug-fix itself, you can see the relevant patch here. The problem was that the code that handled abrupt socket closure wasn’t handshaking with enough of the internals of the server to ensure that the last few work items were being processed successfully. Trapping socket closure in the STOMP adapter code, and politely handshaking, turned out to be all that was required. An alternative workaround would be to use STOMP’s DISCONNECT method before closing the socket on the client side.


Footnote 1: Note that despite the misleading URL, the snapshot download really is of the STOMP adapter, and not of the broker itself! I’m making use of hgwebdir’s archive-download feature here.

Entry Filed under: Technology, RabbitMQ

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed

Calendar

April 2008
M T W T F S S
« Mar   May »
 123456
78910111213
14151617181920
21222324252627
282930  

Most Recent Posts