Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joe Van Dyk
committed
Apr 19, 2011
1 parent
4018b50
commit 45dfbd4
Showing
1 changed file
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
require 'roger_rabbit' | ||
|
||
|
||
# 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" } | ||
end | ||
|
||
|
||
# Listening for a RPC message. | ||
RogerRabbit.rpc_listen("another-queue") do |args| | ||
args.merge({:true => true}) | ||
end | ||
|
||
# RPC with result directly returned | ||
# Sending an RPC message | ||
result = RogerRabbit.rpc_message("another-queue", :joe => "cool") | ||
# result is { :joe => "cool", :true => "true" } | ||
|
||
|
||
# RPC with result returned in a block | ||
# Sending an RPC message with result as block | ||
RogerRabbit.rpc_message("another-queue", :joe => "cool") do |result| | ||
# result is { :joe => "cool", :true => "true" } | ||
end |