require "rubygems"
require "bunny"
connection = Bunny.new
connection.start
channel = connection.create_channel
# topic exchange name can be any string
exchange = channel.topic("weathr", :auto_delete => true)
...
However, when I run my app, I got this error:
undefined method `topic' for #
What gives? Upon looking at the source, it was found that apparently in 0.9.0 (which is still in beta), the api has changed quite a bit if you are using topics.
Therefore the fix is to upgrade to the pre version of 0.9.
In your Gemfile, add the following:
gem "bunny", ">= 0.9.0.pre6"