Sha256: fe1336f4417d4724309f6d2a87a3ce6fd1e71fa850063ec72ba1190bf9cb65c4

Contents?: true

Size: 752 Bytes

Versions: 6

Compression:

Stored size: 752 Bytes

Contents

module Refinery #:nodoc:
  # Mix this module in to classes that want to access a queue.
  module Queueable
    include Loggable
    include Configurable
    # Get a named queue
    def queue(name)
      queue_provider.queue(name)
    end
    
    # Given the queue name and a block, yield the named queue into 
    # the block.
    def with_queue(name, &block)
      yield queue(name)
    end
    
    protected
    # Get the queue provider. Defaults to RightAws::SqsGen2 running
    # in multi-thread mode.
    def queue_provider
      @queue_provider ||= RightAws::SqsGen2.new(
        config['aws']['credentials']["access_key_id"], 
        config['aws']['credentials']["secret_access_key"],
        {:multi_thread => true}
      )
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
aeden-refinery-0.10.0 lib/refinery/queueable.rb
aeden-refinery-0.10.1 lib/refinery/queueable.rb
aeden-refinery-0.10.2 lib/refinery/queueable.rb
refinery-0.10.0 lib/refinery/queueable.rb
refinery-0.10.1 lib/refinery/queueable.rb
refinery-0.10.2 lib/refinery/queueable.rb