Bunny, a Ruby RabbitMQ Client

Bunny is a synchronous RabbitMQ client that focuses on ease of use. It is feature complete, supports all RabbitMQ 3.0 features and does not have any heavyweight dependencies.

I Know What RabbitMQ and Bunny are, How Do I Get Started?

Right here!

What is Bunny Good For?

One can use amqp gem to make Ruby applications interoperate with other applications (both Ruby and not). Complexity and size may vary from simple work queues to complex multi-stage data processing workflows that involve many applications built with all kinds of technologies.

Specific examples:

Supported Ruby Versions

Bunny 0.9 and more recent versions support

Bunny works sufficiently well on JRuby but there are known JRuby bugs that cause high CPU burn. JRuby users should use March Hare.

Supported RabbitMQ Versions

Bunny 0.8.x and later versions only support RabbitMQ 2.x and 3.x. Bunny 0.7.x and earlier versions support RabbitMQ 1.x and 2.x.

Project Maturity

Bunny is a mature library (started in early 2009) with a stable public API.

Before version 0.9, a lot of functionality was missing. Version 0.9 can be considered to be a "second birthday" for Bunny as it was rewritten from scratch with over a dozen of preview releases over the course of about a year.

We (the maintainers) made our best effort to keep the new version as backwards compatible as possible but within reason.

Installation & Bundler Dependency

Most Recent Release

Gem Version

With Rubygems

To install Bunny with RubyGems:

gem install bunny

Bundler Dependency

To use Bunny in a project managed with Bundler:

gem "bunny", "~> 1.4.0"

Quick Start

Below is a small snippet that demonstrates how to publish and synchronously consume ("pull API") messages with Bunny.

For a 15 minute tutorial using more practical examples, see Getting Started with RabbitMQ and Ruby using Bunny.

require "bunny"

# Start a communication session with RabbitMQ
conn = Bunny.new

# open a channel
ch = conn.create_channel

# declare a queue
q  = ch.queue("test1")

# publish a message to the default exchange which then gets routed to this queue
q.publish("Hello, everybody!")

# fetch a message from the queue
delivery_info, , payload = q.pop

puts "This is the message: #{payload}"

# close the connection


Getting Started

For a 15 minute tutorial using more practical examples, see Getting Started with RabbitMQ and Ruby using Bunny.


Other documentation guides are available at rubybunny.info:

API Reference

Bunny API Reference.

Community and Getting Help

Mailing List

Bunny has a mailing list. We encourage you to also join the RabbitMQ mailing list mailing list. Feel free to ask any questions that you may have.


For more immediate help, please join #rabbitmq on irc.freenode.net.

News & Announcements on Twitter

To subscribe for announcements of releases, important changes and so on, please follow @rubyamqp on Twitter.

More detailed announcements can be found in the blogs

Reporting Issues

If you find a bug, poor default, missing feature or find any part of the API inconvenient, please file an issue on GitHub. When filing an issue, please specify which Bunny and RabbitMQ versions you are using, provide recent RabbitMQ log file contents if possible, and try to explain what behavior you expected and why. Bonus points for contributing failing test cases.

Running the specs

The cleanest way to get the specs running is by starting a clean rabbitmq server node on your machine specifically for the bunny specs.

Make sure you have a recent version of RabbitMQ (> 3.2) and run the following command from the base directory of the gem:

RABBITMQ_NODENAME=bunny RABBITMQ_CONFIG_FILE=./spec/config/rabbitmq RABBITMQ_ENABLED_PLUGINS_FILE=./spec/config/enabled_plugins rabbitmq-server

The specs use the Rabbitmq management plugin and require an SSL port to be available. The config files in the spec/config directory enable these. Please note that this config uses verify_none because the certificates are expired.

Next up you'll need to prepare your node for the specs (Only once):

RABBITMQ_NODENAME=bunny ./bin/ci/before_build.sh

And then run the specs:


Other Ruby RabbitMQ Clients

Other widely used Ruby RabbitMQ clients are March Hare (JRuby-only) and amqp gem. Both are mature libraries and require RabbitMQ 2.x or 3.x.


First, clone the repository and run

bundle install --binstubs

then set up RabbitMQ vhosts with


(if needed, set RABBITMQCTL env variable to point to rabbitmqctl you want to use)

and then run tests with

CI=true ./bin/rspec -cfs spec

After that create a branch and make your changes on it. Once you are done with your changes and all tests pass, submit a pull request on GitHub.


Released under the MIT license.

Bitdeli Badge