Class: Hivent::CLI::Consumer

Inherits:
Object
  • Object
show all
Defined in:
lib/hivent/cli/consumer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Consumer

Returns a new instance of Consumer.



17
18
19
# File 'lib/hivent/cli/consumer.rb', line 17

def initialize(options)
  @options = options
end

Class Method Details

.run!(args) ⇒ Object



13
14
15
# File 'lib/hivent/cli/consumer.rb', line 13

def self.run!(args)
  new(args).run!
end

Instance Method Details

#run!Object



21
22
23
24
25
26
27
28
29
# File 'lib/hivent/cli/consumer.rb', line 21

def run!
  configure
  register_service

  worker_name = "#{Socket.gethostname}:#{Process.pid}"
  @worker = Hivent::Redis::Consumer.new(@redis, @service_name, worker_name, @life_cycle_event_handler)

  @worker.run!
end