Sha256: f31b44b42418224141fd3f2af05e97fefc121ef8852c5c642dd45b585d70ccb1
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
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) begin yield queue(name) rescue Exception => e logger.error "An error occurred when communicating with queue #{name}: #{e.message}" sleep(30) end end protected # Get the queue provider. Defaults to RightAws::SqsGen2 running # in multi-thread mode. def queue_provider if queue_engine = config['queue_engine'] if queue_engine['provider'] == 'beanstalk' && defined?(Beanstalk) @queue_provider ||= Refinery::BeanstalkQueueProvider.new else raise RuntimeError, "Unknown queue provider: #{queue_engine['provider']}" end else if defined?(Typica) @queue_provider ||= Typica::Sqs::QueueService.new( config['aws']['credentials']["access_key_id"], config['aws']['credentials']["secret_access_key"] ) else @queue_provider ||= RightAws::SqsGen2.new( config['aws']['credentials']["access_key_id"], config['aws']['credentials']["secret_access_key"], {:multi_thread => true} ) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
refinery-0.12.2 | lib/refinery/queueable.rb |
refinery-0.12.1 | lib/refinery/queueable.rb |
refinery-0.12.0 | lib/refinery/queueable.rb |