Class: Vx::Worker::CLI

Inherits:
Object
  • Object
show all
Includes:
Common::EnvFile, Helper::Config, Helper::Logger
Defined in:
lib/vx/worker/cli.rb

Instance Method Summary collapse

Methods included from Helper::Logger

#logger

Methods included from Helper::Config

#config

Constructor Details

#initializeCLI

Returns a new instance of CLI.



13
14
15
16
17
# File 'lib/vx/worker/cli.rb', line 13

def initialize
  @options = {}
  parse!
  Worker.initialize!
end

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/vx/worker/cli.rb', line 19

def run
  trap('INT') {
    Thread.new do
      Vx::Common::AMQP.shutdown
    end.join
  }

  Vx::Common::AMQP::Supervisor::Threaded.build(
    Vx::Worker::JobsConsumer => config.workers,
  ).run
end