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/>
29 Once you have the RabbitMQ STOMP adapter code, you will need to
30 compile it against the RabbitMQ server before configuring it.
32 ### Compiling from released server binary packages
34 (Please make sure that you have a version of the STOMP plugin code
35 that is compatible with the version of the server you're using. See
36 below for more information on this topic.)
38 Usually, the server packages are installed to
39 `/usr/lib/erlang/lib/rabbitmq_server-X.Y.Z`. From within the
40 `rabbitmq-stomp` directory, issue the command
42 make RABBIT_SERVER_INCLUDE_DIR=/usr/lib/erlang/lib/rabbitmq_server-X.Y.Z/include
44 ### Compiling from released server source code tarballs
46 (Please make sure that you have a version of the STOMP plugin code
47 that is compatible with the version of the server you're using. See
48 below for more information on this topic.)
50 If you've downloaded a server source code tarball named
51 `rabbitmq-server-X.Y.Z.zip`, unzip it and create a symbolic link that
52 aliases the resulting `rabbitmq-server-X.Y.Z` directory to plain old
55 unzip rabbitmq-server-X.Y.Z.zip
56 ln -s rabbitmq-server-X.Y.Z rabbitmq-server
58 You will then need to compile the RabbitMQ server code:
60 (cd rabbitmq-server; make)
62 Finally, from within the `rabbitmq-stomp` directory, issue the command
66 ### Making sure the STOMP plugin version matches the server version
68 Generally, the STOMP plugin's source code repository is tagged when a
69 new version of the RabbitMQ server is released.
71 For example, if you are using RabbitMQ server version 1.5.3, then
72 examine the output of `hg tags` in your local copy of
77 rabbitmq_v1_5_3 91:5ee5e2c0b64a
78 rabbitmq_v1_5_1 65:2eba20816126
79 rabbitmq_v1_5_0 60:1a1ff5067bb6
80 rabbitmq_v1_4_0 49:71b922193057
81 Migrated to mercurial 11:a28eea2c2a2b
83 To make sure your checkout is at the `rabbitmq_v1_5_3` tag, use `hg
86 hg update rabbitmq_v1_5_3
88 Then proceed with compiling the plugin as explained above.
90 If there is no specific tag for the version of the server you are
91 using, try using the newest tag that has the same major and minor
92 version number. For instance, if you were running RabbitMQ server
93 version 1.5.4, but no corresponding tag on `rabbitmq-stomp` was
94 available, you should try using tag `rabbitmq_v1_5_3`. Another
95 alternative for this hypothetical situation would be to use the tip of
99 default 93:9cd7eba4269c
100 rabbitmq_v1_3_0_branch 45:90dd1726fe0b
101 v1_5 92:0ba97fbaea1f (inactive)
103 4 files updated, 0 files merged, 5 files removed, 0 files unresolved
106 ### Compiling from a Mercurial checkout
108 If you want to use the bleeding-edge features of the broker and/or the
109 STOMP adapter, you will need to clone and compile three separate
110 repositories that work together:
112 hg clone http://hg.rabbitmq.com/rabbitmq-server
113 hg clone http://hg.rabbitmq.com/rabbitmq-codegen
114 hg clone http://hg.rabbitmq.com/rabbitmq-stomp
115 (cd rabbitmq-server; make)
116 (cd rabbitmq-stomp; make)
118 ### Compiling from anywhere else
120 If you have a file system layout not covered above, you can
121 investigate setting the Makefile variables `RABBIT_SOURCE_ROOT`,
122 `RABBIT_SERVER_SOURCE_ROOT`, and/or `RABBIT_SERVER_INCLUDE_DIR`. For
123 example, if you had a particular version of `rabbit.hrl` and
124 `rabbit_framing.hrl` you wanted to use, you might say
126 make RABBIT_SERVER_INCLUDE_DIR=/path/to/include
128 so that the STOMP adapter source code can find the `rabbit.hrl` and
129 `rabbit_framing.hrl` files in the `/path/to/include` directory.
132 ## Running the STOMP adapter
134 ### Configuring the server to start the plugin automatically
136 Most RabbitMQ server packages are set up to cause the server to pick
137 up configuration from `/etc/rabbitmq/rabbitmq.conf`. To tell the
138 server to start your plugin, first make sure it is compiled, and then
139 add the following text to `/etc/rabbitmq/rabbitmq.conf`:
142 -pa /path/to/rabbitmq-stomp/ebin
144 stomp_listeners [{"0.0.0.0",61613}]
145 extra_startup_steps [{"STOMP-listeners",rabbit_stomp,kickstart,[]}]'
147 making sure to update the `/path/to/rabbitmq-stomp/ebin` appropriately
148 for your system. Then restart the server with
150 sudo /etc/init.d/rabbitmq-server restart
152 ### Checking that the adapter is running
154 If the adapter is running, you should be able to connect to port 61613
155 using a STOMP client of your choice. In a pinch, `telnet` or netcat
156 (`nc`) will do nicely:
162 message:Invalid frame
163 content-type:text/plain
166 Could not parse frame
169 That `ERROR` message indicates that the adapter is listening and
170 attempting to parse STOMP frames.
172 Another option is to try out the examples that come with the STOMP
173 adapter -- see below.
175 ### Running the adapter during development
177 If you are working with the full source code for the RabbitMQ server,
178 and you either have the `../rabbitmq-server` directory or
179 `RABBIT_SERVER_SOURCE_ROOT` Makefile variable set up correctly, you
180 can simply say `make run`:
186 make RABBIT_SERVER_SOURCE_ROOT=/some/other/path/to/rabbitmq-server run
188 If this is successful, you should end up with `starting
189 STOMP-listeners ...done` and `broker running` in your terminal.
192 ## Running the examples
196 At this point you can try out the service - for instance, you can run
197 the Ruby examples if you have Ruby and rubygems handy:
199 sudo apt-get install ruby
200 sudo apt-get install rubygems
201 sudo gem install stomp
202 ruby examples/ruby/cb-receiver.rb
204 and in another window
206 ruby examples/ruby/cb-sender.rb
208 It will transfer 10,000 short messages, and end up displaying
211 Test Message number 9998
212 Test Message number 9999
215 in the receiver-side terminal.
220 $ sudo cpan -i Net::Stomp
222 The examples are those from the `Net::Stomp` documentation - run
223 `perldoc Net::Stomp` to read the originals.
225 Run the receiver before the sender to make sure the queue exists at
226 the moment the send takes place. In one terminal window, start the
229 $ perl examples/perl/rabbitmq_stomp_recv.pl
231 In another terminal window, run the sender:
233 $ perl examples/perl/rabbitmq_stomp_send.pl
234 $ perl examples/perl/rabbitmq_stomp_send.pl "hello world"
235 $ perl examples/perl/rabbitmq_stomp_send.pl QUIT
237 The receiver's window should contain the received messages:
239 $ perl examples/perl/rabbitmq_stomp_recv.pl