Module: EQ

Defined in:
lib/eq.rb,
lib/eq/job.rb,
lib/eq/logging.rb,
lib/eq/version.rb

Defined Under Namespace

Modules: Logging, Queueing, Working Classes: ConfigurationError, Job

Constant Summary collapse

DEFAULT_CONFIG =
{
  queue: 'sequel',
  sequel: 'sqlite:/',
  job_timeout: 5 # in seconds
}.freeze
VERSION =
'0.0.1'

Class Method Summary collapse

Class Method Details

.bootObject

this boots queuing and working optional: to use another queuing or working subsystem just do require ‘eq/working’ or require ‘eq/queueing’ instead of require ‘eq/all’



28
29
30
31
# File 'lib/eq.rb', line 28

def boot
  boot_queueing if defined? EQ::Queueing
  boot_working if defined? EQ::Working
end

.boot_queueingObject



38
39
40
# File 'lib/eq.rb', line 38

def boot_queueing
  EQ::Queueing.boot
end

.boot_workingObject



42
43
44
# File 'lib/eq.rb', line 42

def boot_working
  EQ::Working.boot
end

.config {|@config| ... } ⇒ Object

Yields:



19
20
21
22
23
# File 'lib/eq.rb', line 19

def config
  @config ||= OpenStruct.new DEFAULT_CONFIG
  yield @config if block_given?
  @config
end

.loggerObject



62
63
64
# File 'lib/eq.rb', line 62

def logger
  Celluloid.logger
end

.queueObject



46
47
48
# File 'lib/eq.rb', line 46

def queue
  EQ::Queueing.queue
end

.queueing?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/eq.rb', line 54

def queueing?
  queue.alive?
end

.shutdownObject



33
34
35
36
# File 'lib/eq.rb', line 33

def shutdown
  EQ::Working.shutdown if defined? EQ::Working
  EQ::Queueing.shutdown if defined? EQ::Queueing
end

.workerObject



50
51
52
# File 'lib/eq.rb', line 50

def worker
  EQ::Working.worker
end

.working?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/eq.rb', line 58

def working?
  worker.alive?
end