Skip to content

Instantly share code, notes, and snippets.

@coffeeaddict
Created February 29, 2012 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coffeeaddict/1944228 to your computer and use it in GitHub Desktop.
Save coffeeaddict/1944228 to your computer and use it in GitHub Desktop.
pdefs
# fire and forget a workitem into the great unknown
# => 'Saturn, we are sending a ship. In 10 years'
#
sequence do
notify_saturn :forget => true
build_spaceship
launch_spaceship :destination => 'saturn'
end
# wait for 'it' to come in
sequence do
listen_for_it :queue => "stephen.king.audio_books.*"
play_it_to_the_kids
end
# fire and wait for reply
#
sequence do
notify_boss :message => "I quit. Wanna be a star", :reply_to => "third.star.to.the.x_factor"
wait_for :queue => "third.star.to.the.x_factor"
rejoyce
end
pdef = dashboard.process_definition do
_if "${f:routing_key} == it" do
draw_a_clow
end
_if "${f:routing_key} == 'graveyard_shift'" do
draw_a_bat
end
present_drawing
end
listener = Ruote::AMQP::LaunchListener.new(pdef, :queue => "stephen.king.audio_books.*")
connection = AMQP.connect
channel = AMQP::Channel.new(connection)
exchange = channel.topic("pub/sub", :auto_delete => true)
# publishing participant
dashboard.register(
:neverland,
Ruote::Amqp::Participant,
:exchange => exchange,
:routing_key => "third.star.to.the.right"
)
# listening participant
dashboard.register(
:wait_for_return_message,
Ruote::Amqp::Listener,
:exchange => exchange,
:queue => "third.star.to.the.*"
)
pdef:
sequence do
neverland
wait_for_return_message
charlie
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment