Skip to content

Instantly share code, notes, and snippets.

@sfate
Created April 21, 2012 13:30
Show Gist options
  • Save sfate/2437079 to your computer and use it in GitHub Desktop.
Save sfate/2437079 to your computer and use it in GitHub Desktop.
intro Amazon SQS
require 'right_aws'
# aws credits
aws_access_key = {
:id => "your key goes here",
:secret => "your secret access key goes here"
}
# initialize new connection to amazon sqs broker
sqs = RightAws::SqsGen2.new(aws_access_key[:id], aws_access_key[:secret])
# initialize queue
q = sqs.queue("queue_name")
# this will serialize and submit the message Yo!
# to your queue named "queue_name"
q.push("Yo!")
# this will pop a message off of the queue named "queue_name"
returned_msg = q.pop
# will remove the message from the queue
returned_msg.delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment