Created
October 14, 2015 13:03
-
-
Save allcentury/302b6650ded5748dcc47 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
class SQS | |
attr_reader :aws, :queue_url | |
def initialize(aws) | |
@aws = aws | |
@queue_url = "https://sqs.us-east-1.amazonaws.com/my-topic-for-sqs" | |
end | |
def publish_msg(msg) | |
aws.send_message(queue_url: queue_url, message_body: JSON.generate(msg)) | |
end | |
end | |
sqs = SQS.new(Aws::SQS::Client.new) | |
# users is just an array of hashes | |
users.each do |user| | |
# i'd like this to be async | |
sqs.publish_msg(user) | |
end | |
# I don't want the program to end until all threads have finished |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Take a look at this: https://gist.github.com/jdantonio/c4b77b1f724c0aad2b50