-
-
Save yorickpeterse/2efb97451fd27c34aec7 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
$ export AWS_ACCESS_KEY_ID='change me' | |
$ export AWS_SECRET_ACCESS_KEY='change me' | |
$ export AWS_REGION='change me' | |
$ gem install aws-sdk | |
$ ruby setup.rb | |
$ ruby repro.rb |
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 'aws-sdk' | |
require 'json' | |
Thread.abort_on_exception = true | |
puts 'Starting...' | |
threads = 10.times.map do | |
Thread.new do | |
sqs = Aws::SQS::Client.new | |
url = sqs.get_queue_url(:queue_name => 'example').queue_url | |
poller = Aws::SQS::QueuePoller.new(url) | |
poller.poll(:idle_timeout => 5) do |message| | |
JSON.load(message.body) | |
end | |
end | |
end | |
threads.each(&:join) |
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 'aws-sdk' | |
require 'json' | |
sqs = Aws::SQS::Client.new | |
response = sqs.create_queue(:queue_name => 'example') | |
100.times do |number| | |
sqs.send_message( | |
:queue_url => response.queue_url, | |
:message_body => JSON.dump([number]) | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment