Module: Maxwell::Agent
- Defined in:
- lib/maxwell/agent.rb,
lib/maxwell/agent/web.rb,
lib/maxwell/agent/host.rb,
lib/maxwell/agent/work.rb,
lib/maxwell/agent/probe.rb,
lib/maxwell/agent/runner.rb,
lib/maxwell/agent/worker.rb,
lib/maxwell/agent/version.rb,
lib/maxwell/agent/scheduler.rb,
lib/maxwell/agent/web_helpers.rb,
lib/maxwell/agent/configuration.rb,
lib/maxwell/agent/work_schedule.rb,
lib/maxwell/agent/middleware/chain.rb,
lib/maxwell/agent/dynamic_attributes.rb,
lib/maxwell/agent/middleware/logging.rb
Defined Under Namespace
Modules: DynamicAttributes, Middleware, Probe, WebHelpers, Work
Classes: Configuration, Host, Runner, Scheduler, Web, WorkSchedule, Worker
Constant Summary
collapse
- VERSION =
"0.0.5"
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
24
25
26
|
# File 'lib/maxwell/agent.rb', line 24
def configuration
@configuration ||= Configuration.new
end
|
28
29
30
31
|
# File 'lib/maxwell/agent.rb', line 28
def configure
yield configuration if block_given?
configuration
end
|
.middleware {|configuration.middleware_chain| ... } ⇒ Object
49
50
51
52
|
# File 'lib/maxwell/agent.rb', line 49
def middleware
yield configuration.middleware_chain if block_given?
configuration.middleware_chain
end
|
.redis(&block) ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/maxwell/agent.rb', line 62
def redis(&block)
@redis ||= ConnectionPool.new(
size: (configuration.worker_concurrency + 2)) {
Redis.new configuration.redis_options
}
@redis.with(&block)
end
|
.runner ⇒ Object
20
21
22
|
# File 'lib/maxwell/agent.rb', line 20
def runner
@runner
end
|
.running? ⇒ Boolean
54
55
56
|
# File 'lib/maxwell/agent.rb', line 54
def running?
runner.alive?
end
|
.start ⇒ Object
33
34
35
36
37
|
# File 'lib/maxwell/agent.rb', line 33
def start
if dead_runner?
@runner = Runner.run
end
end
|
.start! ⇒ Object
39
40
41
42
43
|
# File 'lib/maxwell/agent.rb', line 39
def start!
if dead_runner?
@runner = Runner.run!
end
end
|
.stop ⇒ Object
45
46
47
|
# File 'lib/maxwell/agent.rb', line 45
def stop
runner.terminate
end
|
.stopped? ⇒ Boolean
58
59
60
|
# File 'lib/maxwell/agent.rb', line 58
def stopped?
!running?
end
|