Class: Karafka::Cli::Worker

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/cli/worker.rb

Overview

Worker Karafka Cli action

Instance Attribute Summary

Attributes inherited from Base

#cli

Instance Method Summary collapse

Methods inherited from Base

bind_to, desc, #initialize, option

Constructor Details

This class inherits a constructor from Karafka::Cli::Base

Instance Method Details

#call(*params) ⇒ Object

Start the Karafka Sidekiq worker

Parameters:

  • params (Array<String>)

    additional params that will be passed to sidekiq, that way we can override any default Karafka settings



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/karafka/cli/worker.rb', line 12

def call(*params)
  puts 'Starting Karafka worker'
  config = "-C #{Karafka::App.root.join('config/sidekiq.yml')}"
  req = "-r #{Karafka.boot_file}"
  env = "-e #{Karafka.env}"

  cli.info

  cmd = "bundle exec sidekiq #{env} #{req} #{config} #{params.join(' ')}"
  puts(cmd)
  exec(cmd)
end