Class: Alondra::Alondra

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/alondra.rb

Class Method Summary collapse

Class Method Details

.start_server!Object



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/alondra.rb', line 66

def self.start_server!
  start_server_proc = Proc.new do
    MessageQueue.instance.start_listening
    Server.run
  end

  if EM.reactor_running?
    EM.schedule(start_server_proc)
  else
    Log.info "starting EM reactor"
    EM.run(start_server_proc)
  end
end

.start_server_in_new_thread!Object



60
61
62
63
64
# File 'lib/alondra.rb', line 60

def self.start_server_in_new_thread!
  Thread.new do
    start_server!
  end
end

.start_with_options(options) ⇒ Object



53
54
55
56
57
58
# File 'lib/alondra.rb', line 53

def self.start_with_options(options)
  options.each do |k, v|
    config.send "#{k}=", v
  end
  start_server_in_new_thread!
end