lib/refinery/queueable.rb in refinery-0.11.0 vs lib/refinery/queueable.rb in refinery-0.12.0
- old
+ new
@@ -13,20 +13,23 @@
def with_queue(name, &block)
begin
yield queue(name)
rescue Exception => e
logger.error "An error occurred when communicating with queue #{name}: #{e.message}"
- puts e.backtrace.map { |t| "\t#{t}" }.join("\n")
sleep(30)
end
end
protected
# Get the queue provider. Defaults to RightAws::SqsGen2 running
# in multi-thread mode.
def queue_provider
- if config['queue_engine'] == 'beanstalk' && defined?(Beanstalk)
- @queue_provider ||= Refinery::BeanstalkQueueProvider.new
+ 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"]
\ No newline at end of file