class EventBus::Daemon
Constants
- INTERRUPTION_SIGNALS
Public Class Methods
bind_signals()
click to toggle source
# File lib/event_bus/daemon.rb, line 17 def self.bind_signals read, write = IO.pipe INTERRUPTION_SIGNALS.each do |signal| Signal.trap(signal) { write.puts(signal) } end begin while io = IO.select([read]) signal = io.first[0].gets.strip raise Interrupt if INTERRUPTION_SIGNALS.include?(signal) end rescue Interrupt stop end end
start()
click to toggle source
# File lib/event_bus/daemon.rb, line 5 def self.start Listeners::Manager.bind_all_listeners bind_signals end
stop()
click to toggle source
# File lib/event_bus/daemon.rb, line 11 def self.stop EventBus::Config.broker.close_connection exit end