Posts filed under 'RabbitMQ'
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:
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 -
Next, grab the latest STOMP adapter:
curl http://hg.opensource.lshift.net/rabbitmq-stomp/archive/rabbitmq_v1_3_0_branch.tar.gz | tar -zxvf -
Compile the server itself:
make -C rabbitmq-1.3.0/erlang/rabbit
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.
April 30th, 2008
tonyg
Apropos of RabbitMQ
- In Native American Ojibwe mythology, Nanabozho, or Great Rabbit, is an
important deity related to the creation of the world
- The term kit or kitten has been used to refer to a young rabbit. A group of young rabbits is referred to as a kindle
- Varron (116 to 27 BC) suggested that rabbits be kept in leporaria, stone-walled pens or parks
- The physiology of the rabbit digestive system is such that they are not able to vomit
- The Greek for rabbit is Lago, while the Latin is cuniculus
- In Central Africa Kalulu the rabbit is widely known as a tricky character, getting the better of bargains
- Rabbits are small mammals in the family Leporidae, of the order Lagomorpha. There are many species of rabbit, and these, along with cottontails, pikas, and hares, make up the order Lagomorpha
- The smallest rabbit is the pygmy rabbit (Brachylagus idahoensis)
- The only auditory signal known for most species is a loud foot thump made to indicate alarm or aggression. Notable exceptions are the Amami rabbit and the Volcano rabbit of Mexico, which both utter a variety of calls
- A male rabbit is a buck
- Newborn rabbits are naked, blind, and helpless at birth (altricial)
- Breeding rabbits for meat is called cuniculture
- In Aztec mythology, a pantheon of four hundred rabbit gods known as Centzon Totochtin, led by Ometotchtli or Two Rabbit, represented fertility, parties, and drunkenness
- Their urine, being high in nitrogen, makes lemon trees very productive
- The Romans ate newborn rabbits, which they called laurices
March 4th, 2008
andy
Barry Pederson’s excellent py-amqplib Python AMQP client comes with a very cute little demo, demonstrating how easy it is to do sophisticated cron-like things with AMQP and RabbitMQ.
As Barry writes in the example, the trick is to “[fire] off simple messages at one-minute intervals to a topic exchange named ‘clock’, with the topic of the message being the local time as ‘year.month.date.dow.hour.minute‘, for example: ‘2007.11.26.1.12.33′, where the dow (day of week) is 0 for Sunday, 1 for Monday, and so on (similar to Unix crontab). A consumer could then bind a queue to the routing key ‘#.0′ for example to get a message at the beginning of each hour.”
Lovely!
February 8th, 2008
tonyg
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.
Continue Reading February 2nd, 2008
tonyg
We’ve just finished and released our .NET/C# client library for AMQP. We developed it on Mono, and made sure it ran on the Microsoft .NET stacks as well - versions 1.1 and 2.0. There’s also a WCF binding, for exposing WCF-based services over AMQP. (The WCF binding only compiles and runs on the Microsoft CLR implementations, until Mono’s Olive WCF implementation matures a little, anyway.)
One interesting thing about the library is its support for more than just one protocol variant: it speaks AMQP 0-8 as standardised, AMQP 0-8 as extended by QPid, and AMQP 0-9 as standardised (sans the bits of the spec marked “work in progress”, ie. the Message class). You can switch protocol variants at runtime, and there’s a common interface that abstracts away from the incompatibilities in the protocol variants. We’ve run the library against RabbitMQ (of course), as well as QPid-java and OpenAMQ 1.2c4.
The library is documented in a PDF user guide, which actually contains quite a bit of useful general AMQP information and guidelines, and could form the core of a language-neutral RabbitMQ manual. The detailed API guide is also available - you can download the code, the binaries, and all the different reformattings of the documentation on the interim page for the .NET/C# client library.
Our RabbitMQ website is starting to look a bit messy, so we’re working on a revised layout that should be a bit tidier; then, the .NET stuff will be presented alongside all the other client libraries and bindings we have available, rather than being presented as a separate-looking piece.
January 30th, 2008
tonyg