Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (24 sloc) 965 Bytes
roger_rabbit is a wrapper around the bunny rabbitmq gem
that makes doing things with rabbitmq simple.
The point is to come up with a set of conventions that make
rabbitmq services easy to configure, maintain, develop, and
# Messages are transmitted as json. Deserialized as
# ActiveSupport::HashWithIndifferentAccess.
# Publishing a message, don't care about result.
RogerRabbit.publish "queue-name", :joe => "cool"
# Consuming the above message.
RogerRabbit.consume "queue-name" do |msg|
# msg is { :joe => "cool" }
# Listening for a RPC message.
RogerRabbit.rpc_listen("another-queue") do |args|
args.merge({:true => true})
# Sending an RPC message
result = RogerRabbit.rpc_message("another-queue", :joe => "cool")
# result is { :joe => "cool", :true => "true" }
# Sending an RPC message with result as block
RogerRabbit.rpc_message("another-queue", :joe => "cool") do |result|
# result is { :joe => "cool", :true => "true" }