Last active
August 29, 2015 13:57
-
-
Save krishna-shilpakar/9736416 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
require "amqp" | |
EventMachine.run do | |
connection = AMQP.connect | |
channel = AMQP::Channel.new(connection) | |
replies_queue = channel.queue("citizen40.install.app.acknowledge", :exclusive => true, :auto_delete => true) | |
replies_queue.subscribe do |metadata, payload| | |
puts "[response] Response for #{metadata.correlation_id}: #{payload.inspect}" | |
# if payload[:success] == true | |
connection.close { EventMachine.stop } | |
# end | |
end | |
# request time from a peer every 3 seconds | |
puts "[request] Sending a request to install softwar..." | |
payload = {:app => 'ftp}.to_yaml | |
channel.default_exchange.publish(payload, :routing_key => "citizen40.install.app") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment