Module: EQ::Queueing::Backends

Defined in:
lib/eq-queueing/backends.rb,
lib/eq-queueing/backends/sequel.rb,
lib/eq-queueing/backends/leveldb.rb

Defined Under Namespace

Classes: BackendLoadError, LevelDB, Sequel

Class Method Summary collapse

Class Method Details

.init(config) ⇒ Object

Raises:

  • ConfigurationError when config.queue is not supported



9
10
11
12
13
14
15
# File 'lib/eq-queueing/backends.rb', line 9

def init config
  if %w[ sequel leveldb ].include? config.queue
    initialize_queue config
  else
    raise EQ::ConfigurationError, "config.queue = '#{config.queue}' is not supported!"
  end
end

.initialize_queue(config) ⇒ Object

Raises:

  • LoadError when required gem is not available



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/eq-queueing/backends.rb', line 18

def initialize_queue config
  queue_config = config.send(config.queue)
  case EQ.config.queue
  when 'sequel'
    require_queue 'sequel'
    EQ::Queueing::Backends::Sequel.new queue_config
  when 'leveldb'
    require_queue 'leveldb'
    EQ::Queueing::Backends::LevelDB.new queue_config
  end
end

.require_queue(queue_name) ⇒ Object



30
31
32
# File 'lib/eq-queueing/backends.rb', line 30

def require_queue queue_name
  require File.join(File.dirname(__FILE__), 'backends', queue_name)
end