Class: Nezu::Runner
- Inherits:
-
Object
- Object
- Nezu::Runner
- Defined in:
- lib/nezu/runner.rb
Class Method Summary collapse
-
.start ⇒ Object
this is the starting point for every application running with “$> nezu run” it get called from cli.rb.
- .stop(exit_code = 0) ⇒ Object
Class Method Details
.start ⇒ Object
this is the starting point for every application running with “$> nezu run” it get called from cli.rb
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/nezu/runner.rb', line 12 def self.start amqp_config = Nezu::Config.amqp[Nezu.env.to_sym] AMQP.start(amqp_config.url) do |connection, open_ok| Nezu.logger.debug("[Nezu Runner] AMQP connection #{amqp_config.url}") channel = AMQP::Channel.new(connection, :auto_recovery => true) Nezu.logger.debug("[Nezu Runner] AMQP channel #{channel}") Nezu::Runtime::Consumer.descendants.each do |consumer| Nezu.logger.debug("[Nezu Runner] Consumer.descendants: ##{consumer.to_s}") worker = Nezu::Runtime::Worker.new(channel, consumer.new) worker.start end end rescue => e Nezu.logger.fatal("#{self.inspect} died restarting") Nezu.logger.fatal(e) sleep 60 self.start end |