Skip to content

Instantly share code, notes, and snippets.

Created May 2, 2013 11:39
Show Gist options
  • Save anonymous/5501665 to your computer and use it in GitHub Desktop.
Save anonymous/5501665 to your computer and use it in GitHub Desktop.
sqs からメッセージを取得
# coding: utf-8
require 'rubygems'
require 'bundler/setup'
require 'aws-sdk'
AWS.config(:access_key_id => '***',
:secret_access_key => '***',
:sns_endpoint => 'sns.ap-northeast-1.amazonaws.com')
url = 'https://sqs.ap-northeast-1.amazonaws.com/396922540073/sample-queue'
sqs = AWS::SQS.new
while true
receive = sqs.queues[url].receive_message()
if receive
puts receive.body
sleep 1
end
puts "Waiting"
sleep 1
end
# EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment