Module: QProcessor::Sources

Defined in:
lib/qprocessor/sources.rb

Class Method Summary collapse

Class Method Details

.manufacture!Object

This method checks environment variables to see if any are set such that a queue source can be generated from them. When checking environment variables Beanstalk has highest priority, followed by SQS. If no matching environment variables are found then an exception will be raised. For Beanstalk the BEANSTALK_URL environment variable is checked for. For SQS the SQS_QUEUE_NAME environment variable is check for.



12
13
14
15
16
17
18
19
20
# File 'lib/qprocessor/sources.rb', line 12

def self.manufacture!
  if !ENV["BEANSTALK_URL"].nil?
    QProcessor::BeanstalkSource.new
  elsif !ENV["SQS_QUEUE_NAME"].nil?
    QProcessor::SQSSource.new
  else
    raise "Unable to determine source queue type from environment settings."
  end
end