RabbitMQ – A Fast, Reliable Queuing Option for Rubyists
Tháng Tư 11, 2009
When it comes to developing large systems with many interdependent parts, it’s common nowadays to use “queues.” A queue is, for the most part, just a list that you can add items to and remove items from. Apps can use queues to despatch jobs / tasks to other apps or to shuttle logs and status information around.
RabbitMQ is a fast, reliable, open source queueing option. It’s not developed in Ruby, though, but in Erlang, a functional language with a reputation for distributed, high availability, fault tolerant apps. It presents itself as a separate daemon – much as Apache, Passenger, memcached, or MySQL aren’t written in Ruby. Using it from Ruby isn’t difficult, and, of course, you can use it from a multitude of languages so if you want to push in items from Ruby and pull them out to be processed with something else (or vice versa) it’s ideal. RabbitMQ can be used as a hub for communication between all of your processes.
On RabbitMQ, Rany Keddo, the developer of Workling, said:
If you’re doing high volume messaging and need a high degree of reliability, you should definitely consider using RabbitMQ over Starling.
(And since I started to draft this article, this point has perhaps been proven even more with Twitter’s ditching of Starling for a new, Scala-based system.)
So RabbitMQ has the power and reputation and if you want to do some serious queueing, you should be checking it out. With that in mind, Alexis Richardson (from the RabbitMQ team) and I have put together a few resources that will be useful to you (as a Rubyist) if/when you decide to check RabbitMQ out:
Official RabbitMQ Homepage – Homepage with general feature information, links to documentation, downloads and examples.
Installing RabbitMQ on OS X – A guide to installing RabbitMQ on Mac OS X by Rany Keddo. With the installation of Erlang, it’s not quite the quickest process, but it’s worth the wait.
AMQP “driver” for Ruby/EventMachine – A Ruby library by Aman Gupta that provides an event driven AMQP implementation for Rubyists, built around EventMachine. Works on Ruby 1.8, 1.9, and JRuby and tested directly against RabbitMQ.
Riding the Rabbit – A blog post by Dan Sinclair that demonstrates the setup of a RabbitMQ instance, and the use of the aforementioned AMQP Ruby/EventMachine library.
OH HAI RabbitMQ! Screencast – A great screencast by British Rubyist Jonathan Conway that demonstrates how to set up RabbitMQ and perform some basic operations.
Warren – A wrapper for AMQP – A library for pushing messages on to RabbitMQ queues (and receiving them at the other end) by the Brightbox crew. Authentication and filtering features can be added through custom classes.
RabbitMQ and Ruby presentation – Ben Hood (one of RabbitMQ’s developers) gives a 40 minute presentation on RabbitMQ and Ruby. He looks at the background of RabbitMQ, the motivations behind using something like RabbitMQ, the approaches that have been taken in the past, AMQP, and, yes, a lot more.