README
author David Wragg <david@rabbitmq.com>
Wed Sep 01 12:11:13 2010 +0100 (8 days ago)
changeset 160 f03ca7184fc4
parent 134ea75065f6ee8
permissions -rw-r--r--
Merge bug23130 into default (place plugin version into .app descriptor
     1 # RabbitMQ STOMP adapter
     2 
     3 ## Introduction
     4 
     5 This is a STOMP adapter plugin for use with RabbitMQ.
     6 
     7  - <http://stomp.codehaus.org/>
     8  - <http://www.rabbitmq.com/>
     9  - <https://dev.rabbitmq.com/wiki/StompGateway>
    10 
    11 You can get the code by checking it out from our repository with
    12 
    13     hg clone http://hg.rabbitmq.com/rabbitmq-stomp/
    14 
    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
    17 for details.
    18 
    19 Announcements regarding the adapter are periodically made on the
    20 RabbitMQ mailing list and on LShift's blog.
    21 
    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/>
    25 
    26 
    27 ### Compiling from a Mercurial checkout
    28 
    29 (This instructions work only for RabbitMQ 1.7.0 or newer.)
    30 
    31 To compile RabbitMQ STOMP adapter plugin, you will need to download
    32 rabbitmq-public-umbrella package:
    33 
    34     hg clone http://hg.rabbitmq.com/rabbitmq-public-umbrella
    35 
    36 Umbrella is a placeholder for various packages. You need to actually
    37 download and compile the dependencies. The simplest way is to run:
    38 
    39     cd rabbitmq-public-umbrella
    40     make co
    41     make
    42 
    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.
    46 
    47 
    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:
    51 
    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
    55 
    56 
    57 ### Building plugin package
    58 
    59 To build a plugin package (*.ez file), run 'make package' from the
    60 rabbitmq-stomp directory. Package should appear in 'dist' directory.
    61 
    62     cd rabbitmq-stomp
    63     make package
    64     ls dist/rabbitmq_stomp.ez
    65 
    66 
    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
    70 
    71 You need to install rabbit_stomp.ez package.
    72 
    73 ## Running the STOMP adapter
    74 
    75 ### Configuring the server to start the plugin automatically
    76 
    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`:
    81 
    82     SERVER_START_ARGS='-rabbit_stomp listeners [{"0.0.0.0",61613}]'
    83 
    84 Then restart the server with
    85 
    86     sudo /etc/init.d/rabbitmq-server restart
    87 
    88 
    89 When no configuration is specified STOMP Adapter will listen on localhost by
    90 default.
    91 
    92 ### Checking that the adapter is running
    93 
    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:
    97 
    98     $ nc localhost 61613
    99     dummy
   100     dummy
   101     ERROR
   102     message:Invalid frame
   103     content-type:text/plain
   104     content-length:22
   105     
   106     Could not parse frame
   107     $ 
   108 
   109 That `ERROR` message indicates that the adapter is listening and
   110 attempting to parse STOMP frames.
   111 
   112 Another option is to try out the examples that come with the STOMP
   113 adapter -- see below.
   114 
   115 ### Running the adapter during development
   116 
   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`:
   119 
   120     make run
   121 
   122 If this is successful, you should end up with `starting
   123 STOMP Adapter ...done` and `broker running` in your terminal.
   124 
   125 
   126 ## Running tests and code coverage
   127 
   128 To run simplistic test suite and see the code coverage type:
   129 
   130     make cover
   131 
   132 After successfull run, you should be able to see output similar to:
   133 
   134     ............
   135     ----------------------------------------------------------------------
   136     Ran 12 tests in 0.300s
   137     [...]
   138     **** Code coverage ****
   139      54.55 rabbit_stomp
   140      80.88 rabbit_stomp_frame
   141      74.87 rabbit_stomp_server
   142     100.00 rabbit_stomp_sup
   143      75.72 'TOTAL'
   144 
   145 The view the code coverage, see html files in .cover:
   146 
   147     ls ./cover
   148 
   149     rabbit_stomp_frame.html
   150     rabbit_stomp.html
   151     rabbit_stomp_server.html
   152     rabbit_stomp_sup.html
   153     summary.txt
   154 
   155 
   156 ## Running the examples
   157 
   158 ### Ruby
   159 
   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:
   162 
   163     sudo apt-get install ruby
   164     sudo apt-get install rubygems
   165     sudo gem install stomp
   166     ruby examples/ruby/cb-receiver.rb
   167 
   168 and in another window
   169 
   170     ruby examples/ruby/cb-sender.rb
   171 
   172 It will transfer 10,000 short messages, and end up displaying
   173 
   174     ...
   175     Test Message number 9998
   176     Test Message number 9999
   177     All Done!
   178 
   179 in the receiver-side terminal.
   180 
   181 
   182 ### Perl
   183 
   184     $ sudo cpan -i Net::Stomp
   185 
   186 The examples are those from the `Net::Stomp` documentation - run
   187 `perldoc Net::Stomp` to read the originals.
   188 
   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
   191 receiver:
   192 
   193     $ perl examples/perl/rabbitmq_stomp_recv.pl
   194 
   195 In another terminal window, run the sender:
   196 
   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
   200 
   201 The receiver's window should contain the received messages:
   202 
   203     $ perl examples/perl/rabbitmq_stomp_recv.pl 
   204     test message
   205     hello
   206     QUIT
   207     $