Sha256: 96314ba45405eee17f151dab6a5fa843fd4452b067bdb446da729d448e49a77c

Contents?: true

Size: 451 Bytes

Versions: 11

Compression:

Stored size: 451 Bytes

Contents

module Propono
  class QueueCreatorError < Exception
  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
      result = sqs.create_queue(@name)
      body = result.body
      url = body.fetch('QueueUrl') { raise QueueCreatorError.new("No QueueUrl returned from SQS") }
      Queue.new(url)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
propono-0.5.6 lib/propono/services/queue_creator.rb
propono-0.5.5 lib/propono/services/queue_creator.rb
propono-0.5.4 lib/propono/services/queue_creator.rb
propono-0.5.3 lib/propono/services/queue_creator.rb
propono-0.5.2 lib/propono/services/queue_creator.rb
propono-0.5.1 lib/propono/services/queue_creator.rb
propono-0.5.0 lib/propono/services/queue_creator.rb
propono-0.4.0 lib/propono/services/queue_creator.rb
propono-0.3.0 lib/propono/services/queue_creator.rb
propono-0.2.0 lib/propono/services/queue_creator.rb
propono-0.1.0 lib/propono/queue_creator.rb