Class: Wildcloud::Logeen::Engine
- Inherits:
-
Object
- Object
- Wildcloud::Logeen::Engine
- Defined in:
- lib/wildcloud/logeen/engine.rb
Instance Method Summary collapse
- #<<(message) ⇒ Object
- #configuration ⇒ Object
-
#initialize ⇒ Engine
constructor
A new instance of Engine.
- #start ⇒ Object
Constructor Details
#initialize ⇒ Engine
Returns a new instance of Engine.
13 14 15 |
# File 'lib/wildcloud/logeen/engine.rb', line 13 def initialize @queue = Queue.new end |
Instance Method Details
#<<(message) ⇒ Object
17 18 19 |
# File 'lib/wildcloud/logeen/engine.rb', line 17 def <<() @queue << end |
#configuration ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/wildcloud/logeen/engine.rb', line 35 def configuration return @configuration if @configuration config = Wildcloud::Configuration.load('logeen') config.sources.each do |source| #self.logger.info('Configuration', "Loaded configuration from #{source}") end @configuration = config.configuration end |
#start ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/wildcloud/logeen/engine.rb', line 21 def start @amqp = AMQP.connect(self.configuration['amqp']) @channel = AMQP::Channel.new(@amqp) @exchange = @channel.topic('wildcloud.logger') EventMachine.start_server('0.0.0.0', 4100, Wildcloud::Logeen::Transport::Raw, self) @thread = Thread.new do loop do msg = @queue.pop @exchange.publish(msg, :routing_key => 'wildcloud.logeen') end end end |