Today I needed to look into working with AWS SQS using Ruby. Google eventually lead me to the Rightscale AWS project on github. This looked great but so far is missing SNS support which we also needed. Fortunately bemurphy forked the Rightscale project and added SNS support in a branch named ‘add_sns’.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'right_aws'
aws_access_key_id = "your key goes here"
aws_secret_access_key = "your secret access key goes here"
queue_name = "anyQueueWillDo"
sqs = RightAws::SqsGen2.new(aws_access_key_id, aws_secret_access_key)

q = sqs.queue(queue_name)

# this will serialize and submit the message Yo! 
# to your queue named "anyQueueWillDo"
q.push("Yo!")

# this will pop a message off of the queue named "anyQueueWillDo"
returned_msg = q.pop 

# will remove the message from the queue
returned_msg.delete

Free Software planner

Gain access to the same planning process we use to prepare our clients.