Class: Rabbitek::CLI

Inherits:
Object
  • Object
show all
Includes:
Loggable
Defined in:
lib/rabbitek/cli.rb,
lib/rabbitek/cli/signal_handlers.rb

Overview

Rabbitek server CLI

Defined Under Namespace

Classes: SignalHandlers

Instance Method Summary collapse

Methods included from Loggable

#debug, #error, #info, #logger, logger, #warn

Instance Method Details

#runObject

rubocop:disable Metrics/AbcSize



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rabbitek/cli.rb', line 17

def run # rubocop:disable Metrics/AbcSize
  opts
  require_application

  Yabeda.configure! unless Yabeda.already_configured?

  map_consumer_workers!

  start_log

  io_r, io_w = IO.pipe
  SignalHandlers.setup(io_w)

  begin
    consumers = boot_consumers

    while io_resp = IO.select([io_r]) # rubocop:disable Lint/AssignmentInCondition
      SignalHandlers.public_send(io_resp.first.first.gets.strip)
    end
  rescue Interrupt
    execute_shutdown(consumers)
  end
end