Created
February 29, 2012 20:40
-
-
Save coffeeaddict/1944228 to your computer and use it in GitHub Desktop.
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
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 |
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
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.*") |
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
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