RabbitMQ Bigwig

This add-on is operated by LShift Ltd

Easy to use, scalable cloud messaging from LShift

RabbitMQ Bigwig

Last Updated: 19 March 2014

Table of Contents

RabbitMQ Bigwig is an Add-on for adding an AMQP message broker to your application.

RabbitMQ provides robust messaging for applications. It is easy to use and supported on all major operating systems and developer platforms.

Messaging enables software applications to connect and scale. Applications can connect to each other, as components of a larger application, or to user devices and data. Messaging is asynchronous, decoupling applications by separating the sending and receiving of data.

The RabbitMQ™ Bigwig add-on is brought to you by LShift. We are a software development company with expertise in VMware’s vFabric™ RabbitMQ™ and a VMware partner. We were also one of the founding companies behind the original development of RabbitMQ™.

RabbitMQ was built from the ground up to interoperate with other technologies: it is the leading implementation of AMQP, the open standard for business messaging.

RabbitMQ can carry any type of message and there are many design patterns you can use to fulfil your use case.

RabbitMQ Bigwig is accessible via an API and has supported client libraries for Ruby, Java, Python, Clojure, Erlang and C#.

Provisioning the add-on

You can attach RabbitMQ Bigwig to a Heroku application via the CLI:

You can find a list of all plans available here.
$ heroku addons:add rabbitmq-bigwig
-----> Adding rabbitmq-bigwig to sharp-mountain-4005... done, v18 (free)

Once you have added RabbitMQ Bigwig you will find RABBITMQ_BIGWIG_TX_URL and RABBITMQ_BIGWIG_RX_URL settings in the app configuration. These contain the canonical URLs used to access the newly provisioned RabbitMQ Bigwig service instance. You can confirm this using the heroku config:get command.

$ heroku config:get RABBITMQ_BIGWIG_RX_URL
amqp://user:pass@instance.ip/resourceid
$ heroku config:get RABBITMQ_BIGWIG_TX_URL
amqp://user:pass@instance.ip/resourceid2

We give you two URLs to ease separating your producers from your consumers. Producers connect to the URL in RABBITMQ_BIGWIG_TX_URL, and we shape this connection to provide consistent throughput. Consumers connect to the URL in RABBITMQ_BIGWIG_RX_URL. We optimise connections to this URL for the consumer case. This separation of producers and consumers follows RabbitMQ best practice. You can read more about how and why we shape here.

After installing RabbitMQ Bigwig you should configure the application to fully integrate with the add-on.

Using with Rails 3.x

Two popular AMQP client libraries for Ruby are the bunny and amqp gems. The amqp gem uses the asynchronous EventMachine framework, and so is not a good fit for a Rails application. Thus, use the bunny gem. Add it to your Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.0.10'
gem 'sqlite3'
gem 'bunny'

[...]

After modifying Gemfile, run bundle install to update Gemfile.lock:

$ bundle install
Fetching source index for https://rubygems.org/
Using rake (0.9.2)
[...]
Using rails (3.0.10)
Your bundle is complete! Use `bundle show [gemname]` to see where
a bundled gem is installed.

For a full example of using Bigwig and the Bunny gem with Rails, please check out our example rails application. Once that’s checked out, you’ll be able to deploy that to heroku by running the following shell commands:

$ git clone git://github.com/lshift/rabbitmq-service-rails-sample.git
...
$ cd rabbitmq-service-rails-sample
$ heroku apps:create
$ heroku addons:add rabbitmq-bigwig
$ git push heroku master
$ heroku apps:open

The command heroku apps:open should open the sample application in your web-browser. If it can’t figure out how to open a browser on your platform, then visiting the URL previously output by heroku apps:create with any browser will work fine.

Using with Ruby (more generally)

The amqp gem is especially appropriate when running on a worker dyno, as it supports writing software that reacts to external events. For example, the following example will listen for messages on the amqpgem.examples.hello_world queue, and exit 60 seconds after it receives the first message.

require "rubygems"
require 'amqp'
require "amqp/extensions/rabbitmq"

EventMachine.run do
  connection = AMQP.connect(:host => '127.0.0.1', :port => 5672, :vhost => 'a')
  puts "Connecting to AMQP broker. Running #{AMQP::VERSION} version of the gem..."

  channel  = AMQP::Channel.new(connection)
  channel.queue("amqpgem.examples.hello_world", :auto_delete => true, :nowait => true) do |queue|
    exchange = channel.default_exchange

    queue.subscribe do |payload|
      puts "Received a message: #{payload}. Disconnecting..."

      EventMachine::Timer.new(60) do
        connection.close {
          EventMachine.stop { exit }
        }
      end
    end

    exchange.publish "Hello, world!", :routing_key => queue.name
  end
end

Development environment

You can install RabbitMQ Bigwig for use in a local development environment. Typically this entails installing RabbitMQ and pointing the RABBITMQ_BIGWIG_TX_URL and RABBITMQ_BIGWIG_RX_URL URLs to this local service via export RABBITMQ_BIGWIG_TX_URL=amqp://guest:guest@localhost/ RABBITMQ_BIGWIG_RX_URL=amqp://guest:guest@localhost/.

RabbitMQ Bigwig uses version 3.0.4. In order to rule out possible differences in behaviour between RabbitMQ versions, you should install version 3.0.4.

If you have… Install with…
Mac OS X
cd /usr/local/
git checkout 181e445c5701070adb63ac3365c68040f26f6a6a Library/Formula/rabbitmq.rb
brew install rabbitmq
Windows http://www.rabbitmq.com/install-windows.html but use this installer instead: http://www.rabbitmq.com/releases/rabbitmq-server/v3.0.4/rabbitmq-server-3.0.4.exe
Debian-like Linux (Debian, Ubuntu, …) Run as root:
$ export DEBIAN_FRONTEND=noninteractive
$ wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc -O /tmp/rabbitmq-signing-key-public.asc
$ apt-key add /tmp/rabbitmq-signing-key-public.asc
$ rm /tmp/rabbitmq-signing-key-public.asc
$ apt-get -y update # Report any bad checksums
$ apt-get -y install erlang-nox=1:14.b.4-dfsg-1ubuntu1
$ wget -O /tmp/package-rmq.deb http://www.rabbitmq.com/releases/rabbitmq-server/v3.0.4/rabbitmq-server_3.0.4-1_all.deb
$ dpkg -i /tmp/package-rmq.deb
$ rm /tmp/package-rmq.deb
Note that Lucid Lynx’s latest Erlang version is `1:13.b.3-dfsg-2ubuntu2.1`.
Other (BSD, Solaris) http://www.rabbitmq.com/releases/rabbitmq-server/v3.0.4/rabbitmq-server-generic-unix-3.0.4.tar.gz

While RabbitMQ will run on Erlang version R12 or above, following RabbitMQ’s advice on which Erlang to use, we strongly suggest using R15 or R16. If you’re running a recent Linux distribution (e.g., Ubuntu Oneiric Ocelot or Precise Pangolin), you shouldn’t have any trouble here, nor should you encounter problems using the installers for either Windows or Mac OS X.

Dashboard

For more information on the features available within the RabbitMQ Bigwig dashboard please see the docs on RabbitMQ’s management plugin.

The RabbitMQ Bigwig dashboard allows you to keep close watch over your broker, controlling your exchanges, queues, bindings, users, and so on.

RabbitMQ Bigwig Dashboard

You can access the dashboard via the CLI:

$ heroku addons:open rabbitmq-bigwig
Opening rabbitmq-bigwig for sharp-mountain-4005...

or by visiting the Heroku apps web interface and selecting the application in question. Select RabbitMQ Bigwig from the Add-ons menu.

Migrating between plans

Application owners should carefully manage the migration timing to ensure proper application function during the migration process.

We will publish details on how to migrate between plans with plan details.

Use the heroku addons:upgrade command to migrate to a new plan.

$ heroku addons:upgrade rabbitmq-bigwig:newplan
----> Upgrading rabbitmq-bigwig:newplan to sharp-mountain-4005... done, v18 ($49/mo)
      Your plan has been updated to: rabbitmq-bigwig:newplan

Removing the add-on

You can remove RabbitMQ Bigwig via the CLI.

This will destroy all associated data and cannot be undone!
$ heroku addons:remove rabbitmq-bigwig
-----> Removing rabbitmq-bigwig from sharp-mountain-4005... done, v20 (free)

Please consume all your messages from your queues before removing the add-on as removal will destroy all data and cannot be undone. Use the web dashboard to confirm.

What precisely are “Rabbit Units”?

Admittedly, it’s a nebulous term, but honestly, we couldn’t think of anything better beyond “Carrots”.

The problem it tries to solve is that the possible throughput on a machine is dependent on many factors, from your messaging topology, the power of the underlying machine, through to the limits on network throughput on the lower tiers. But what we’ve tried to do is make the pricing congruent with the amount of power on offer.

If you’re unsure as to which level of service that you need, just send us an email and we’ll try to help out.

Support

Please submit all RabbitMQ Bigwig support and runtime issues via one of the Heroku Support channels. Any non-support related issues or product feedback is welcome at rabbitmq-bigwig@lshift.net.

Additional resources

Additional resources are available at: