Class: Maxwell::Agent::Runner

Inherits:
Celluloid::SupervisionGroup
  • Object
show all
Defined in:
lib/maxwell/agent/runner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Runner

Returns a new instance of Runner.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/maxwell/agent/runner.rb', line 18

def initialize(opts)
  super

  pool Agent::MiddlewareRunner, size: self.class.worker_pool_size
  supervise_as :work_schedule, Agent::WorkSchedule
  pool Agent::StandardWorker, as: :worker, size: self.class.worker_pool_size
  supervise_as :evented_worker, Agent::EventedWorker
  supervise_as :scheduler, Agent::Scheduler,
    work_schedule: self[:work_schedule],
    worker: self[:worker],
    evented_worker: self[:evented_worker]


  self[:scheduler].async.run

end

Instance Attribute Details

#registryObject (readonly)

Returns the value of attribute registry.



12
13
14
# File 'lib/maxwell/agent/runner.rb', line 12

def registry
  @registry
end

Class Method Details

.worker_pool_sizeObject



14
15
16
# File 'lib/maxwell/agent/runner.rb', line 14

def self.worker_pool_size
  Agent.configuration.worker_concurrency
end

Instance Method Details

#[](actor_name) ⇒ Object



35
36
37
# File 'lib/maxwell/agent/runner.rb', line 35

def [](actor_name)
  @registry[actor_name]
end