Sha256: 2dd6302e61a19068df887b17eb82896dc5a60990d46968d6fd754ead73af151f

Contents?: true

Size: 744 Bytes

Versions: 5

Compression:

Stored size: 744 Bytes

Contents

$: << File.expand_path("../../lib", __FILE__)

require 'simple_aws/sqs'

##
# Expects your Amazon keys to be in the environment, something like
#
# export AWS_KEY="KEY"
# export AWS_SECRET="SECRET"
##

sqs = SimpleAWS::SQS.new ENV["AWS_KEY"], ENV["AWS_SECRET"]

queue_name = "SimpleAWSTest"

puts "Creating queue #{queue_name}"
response = sqs.create_queue "QueueName" => queue_name
queue_url = response.queue_url

puts "Sending message to #{queue_url}"
sent = sqs.send_message queue_url, "MessageBody" => "This is a new message in the queue"

puts ""
p sent
puts ""

puts "Receiving message from #{queue_url}"
received = sqs.receive_message queue_url

puts ""
p received
puts ""

puts "Deleting queue #{queue_url}"
p sqs.delete_queue queue_url

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_aws-1.2.3 samples/sqs.rb
simple_aws-1.2.2 samples/sqs.rb
simple_aws-1.2.1 samples/sqs.rb
simple_aws-1.2.0 samples/sqs.rb
simple_aws-1.1.0 samples/sqs.rb