Class: Sbmt::Outbox::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/sbmt/outbox/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/sbmt/outbox/cli.rb', line 9

def self.exit_on_failure?
  true
end

Instance Method Details

#startObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/sbmt/outbox/cli.rb', line 40

def start
  load_environment

  version = options[:worker_version] || Outbox.default_worker_version

  boxes = format_boxes(options[:box])
  check_deprecations!(boxes, version)

  worker = if version == 1
    Sbmt::Outbox::V1::Worker.new(
      boxes: boxes,
      concurrency: options[:concurrency] || 10
    )
  elsif version == 2
    Sbmt::Outbox::V2::Worker.new(
      boxes: boxes,
      poll_tactic: options[:poll_tactic],
      poller_threads_count: options[:poll_threads],
      poller_partitions_count: options[:poll_concurrency],
      processor_concurrency: options[:concurrency] || 4
    )
  else
    raise "Worker version #{version} is invalid, available versions: 1|2"
  end

  Sbmt::Outbox.current_worker = worker

  watch_signals(worker)

  $stdout.puts AsciiArt.
  $stdout.puts "Outbox/Inbox worker has been started"
  $stdout.puts "Version: #{VERSION}"
  Sbmt::Outbox::Probes::Probe.run_probes
  Sbmt::Outbox::Probes::Metrics.run_metrics

  worker.start
end