1 # RabbitMQ STOMP adapter
5 This is a STOMP adapter plugin for use with RabbitMQ.
7 - <http://stomp.codehaus.org/>
8 - <http://www.rabbitmq.com/>
9 - <https://dev.rabbitmq.com/wiki/StompGateway>
11 You can get the code by checking it out from our repository with
13 hg clone http://hg.rabbitmq.com/rabbitmq-stomp/
15 Please make sure that after you have cloned the repository you update
16 it to the correct tag for your RabbitMQ server version -- see below
19 Announcements regarding the adapter are periodically made on the
20 RabbitMQ mailing list and on LShift's blog.
22 - <http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss>
23 - <http://www.lshift.net/blog/>
24 - <http://www.lshift.net/blog/category/lshift-sw/rabbitmq/>
27 ### Compiling from a Mercurial checkout
29 (This instructions work only for RabbitMQ 1.7.0 or newer.)
31 To compile RabbitMQ STOMP adapter plugin, you will need to download
32 rabbitmq-public-umbrella package:
34 hg clone http://hg.rabbitmq.com/rabbitmq-public-umbrella
36 Umbrella is a placeholder for various packages. You need to actually
37 download and compile the dependencies. The simplest way is to run:
39 cd rabbitmq-public-umbrella
43 This will download and compile all the rabbitmq related packages. Actually
44 you don't have to compile everything, the required packages are only
45 rabbitmq-codegen, rabbitmq-server and rabbitmq-stomp.
48 If you want to compile a plugin for a specific release of the broker,
49 you just need to update mercurial repository to a proper tag. To do
50 that you can say from the umbrella directory:
52 hg -R rabbitmq-codegen up rabbitmq_v1_X_X
53 hg -R rabbitmq-server up rabbitmq_v1_X_X
54 hg -R rabbitmq-stomp up rabbitmq_v1_X_X
57 ### Building plugin package
59 To build a plugin package (*.ez file), run 'make package' from the
60 rabbitmq-stomp directory. Package should appear in 'dist' directory.
64 ls dist/rabbitmq_stomp.ez
67 To install and activate package, please follow the instructions from
68 Plugin Development Guide:
69 http://www.rabbitmq.com/plugin-development.html#activating-a-plugin
71 You need to install rabbit_stomp.ez package.
73 ## Running the STOMP adapter
75 ### Configuring the server to start the plugin automatically
77 Most RabbitMQ server packages are set up to cause the server to pick
78 up configuration from `/etc/rabbitmq/rabbitmq.conf`. To tell the
79 server to start your plugin, first make sure it is compiled, and then
80 add the following text to `/etc/rabbitmq/rabbitmq.conf`:
82 SERVER_START_ARGS='-rabbit_stomp listeners [{"0.0.0.0",61613}]'
84 Then restart the server with
86 sudo /etc/init.d/rabbitmq-server restart
89 When no configuration is specified STOMP Adapter will listen on localhost by
92 ### Checking that the adapter is running
94 If the adapter is running, you should be able to connect to port 61613
95 using a STOMP client of your choice. In a pinch, `telnet` or netcat
96 (`nc`) will do nicely:
102 message:Invalid frame
103 content-type:text/plain
106 Could not parse frame
109 That `ERROR` message indicates that the adapter is listening and
110 attempting to parse STOMP frames.
112 Another option is to try out the examples that come with the STOMP
113 adapter -- see below.
115 ### Running the adapter during development
117 If you are working with the full source code for the RabbitMQ server,
118 and you have the `../rabbitmq-server` directory you can simply say `make run`:
122 If this is successful, you should end up with `starting
123 STOMP Adapter ...done` and `broker running` in your terminal.
126 ## Running tests and code coverage
128 To run simplistic test suite and see the code coverage type:
132 After successfull run, you should be able to see output similar to:
135 ----------------------------------------------------------------------
136 Ran 12 tests in 0.300s
138 **** Code coverage ****
140 80.88 rabbit_stomp_frame
141 74.87 rabbit_stomp_server
142 100.00 rabbit_stomp_sup
145 The view the code coverage, see html files in .cover:
149 rabbit_stomp_frame.html
151 rabbit_stomp_server.html
152 rabbit_stomp_sup.html
156 ## Running the examples
160 At this point you can try out the service - for instance, you can run
161 the Ruby examples if you have Ruby and rubygems handy:
163 sudo apt-get install ruby
164 sudo apt-get install rubygems
165 sudo gem install stomp
166 ruby examples/ruby/cb-receiver.rb
168 and in another window
170 ruby examples/ruby/cb-sender.rb
172 It will transfer 10,000 short messages, and end up displaying
175 Test Message number 9998
176 Test Message number 9999
179 in the receiver-side terminal.
184 $ sudo cpan -i Net::Stomp
186 The examples are those from the `Net::Stomp` documentation - run
187 `perldoc Net::Stomp` to read the originals.
189 Run the receiver before the sender to make sure the queue exists at
190 the moment the send takes place. In one terminal window, start the
193 $ perl examples/perl/rabbitmq_stomp_recv.pl
195 In another terminal window, run the sender:
197 $ perl examples/perl/rabbitmq_stomp_send.pl
198 $ perl examples/perl/rabbitmq_stomp_send.pl "hello world"
199 $ perl examples/perl/rabbitmq_stomp_send.pl QUIT
201 The receiver's window should contain the received messages:
203 $ perl examples/perl/rabbitmq_stomp_recv.pl