-
-
Save mndoci/4714562 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
access_key_id: xxx | |
secret_access_key: yyy |
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
#!/usr/bin/env ruby | |
require 'yaml' | |
require 'aws-sdk' | |
config_file = File.join(File.dirname(__FILE__),"config.yml") | |
config = YAML.load(File.read(config_file)) | |
AWS.config(config) | |
sqs = AWS::SQS.new | |
queue = sqs.queues.create("my_queue") | |
queue.poll do |msg| | |
puts msg.body | |
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
#!/usr/bin/env ruby | |
require 'yaml' | |
require 'aws-sdk' | |
config_file = File.join(File.dirname(__FILE__),"config.yml") | |
config = YAML.load(File.read(config_file)) | |
AWS.config(config) | |
# http://rubydoc.info/github/amazonwebservices/aws-sdk-for-ruby/master/AWS/SQS | |
sqs = AWS::SQS.new | |
queue = sqs.queues.create("my_queue") | |
# http://rubydoc.info/github/amazonwebservices/aws-sdk-for-ruby/master/AWS/SQS/Queue | |
send = lambda { |name, queue| | |
while true do | |
queue.send_message("#{name}:#{Time.now.to_s}") | |
sleep 1 | |
end | |
} | |
Thread.new { send.call("t1", queue) } | |
Thread.new { send.call("t2", queue) } | |
Thread.new { send.call("t3", queue) } | |
sleep 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment