Sha256: 70e4407fa9a161d2b436568d60bae5d8843daaf0e330774591b536b3705b0c1c
Contents?: true
Size: 615 Bytes
Versions: 3
Compression:
Stored size: 615 Bytes
Contents
module Propono class QueueCreatorError < ProponoError end class QueueCreator include Sqs def self.find_or_create(name) new(name).find_or_create end def initialize(name) @name = name end def find_or_create urls = sqs.list_queues("QueueNamePrefix" => @name).body["QueueUrls"] url = urls.select{|x|x =~ /#{@name}$/}.first unless url result = sqs.create_queue(@name) body = result.body url = body.fetch('QueueUrl') { raise QueueCreatorError.new("No QueueUrl returned from SQS") } end Queue.new(url) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
propono-1.7.0 | lib/propono/services/queue_creator.rb |
propono-1.6.0 | lib/propono/services/queue_creator.rb |
propono-1.5.0 | lib/propono/services/queue_creator.rb |