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.1"
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
19
20
21
|
# File 'lib/maxwell/agent.rb', line 19
def configuration
@configuration ||= Configuration.new
end
|
23
24
25
26
|
# File 'lib/maxwell/agent.rb', line 23
def configure
yield configuration if block_given?
configuration
end
|
.middleware {|configuration.middleware_chain| ... } ⇒ Object
44
45
46
47
|
# File 'lib/maxwell/agent.rb', line 44
def middleware
yield configuration.middleware_chain if block_given?
configuration.middleware_chain
end
|
.redis(&block) ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/maxwell/agent.rb', line 57
def redis(&block)
@redis ||= ConnectionPool.new(
size: (configuration.worker_concurrency + 2)) {
Redis.new configuration.redis_options
}
@redis.with(&block)
end
|
.runner ⇒ Object
15
16
17
|
# File 'lib/maxwell/agent.rb', line 15
def runner
@runner
end
|
.running? ⇒ Boolean
49
50
51
|
# File 'lib/maxwell/agent.rb', line 49
def running?
runner.alive?
end
|
.start ⇒ Object
28
29
30
31
32
|
# File 'lib/maxwell/agent.rb', line 28
def start
if dead_runner?
@runner = Runner.run
end
end
|
.start! ⇒ Object
34
35
36
37
38
|
# File 'lib/maxwell/agent.rb', line 34
def start!
if dead_runner?
@runner = Runner.run!
end
end
|
.stop ⇒ Object
40
41
42
|
# File 'lib/maxwell/agent.rb', line 40
def stop
runner.terminate
end
|
.stopped? ⇒ Boolean
53
54
55
|
# File 'lib/maxwell/agent.rb', line 53
def stopped?
!running?
end
|