module Maxwell::Agent
Constants
- VERSION
Public Class Methods
configuration()
click to toggle source
# File lib/maxwell/agent.rb, line 28 def configuration @configuration ||= Configuration.new end
configure() { |configuration| ... }
click to toggle source
# File lib/maxwell/agent.rb, line 32 def configure yield configuration if block_given? configuration end
middleware() { |middleware_chain| ... }
click to toggle source
# File lib/maxwell/agent.rb, line 53 def middleware yield configuration.middleware_chain if block_given? configuration.middleware_chain end
redis(&block)
click to toggle source
# File lib/maxwell/agent.rb, line 66 def redis(&block) @redis ||= ConnectionPool.new( size: (configuration.worker_concurrency + 2)) { Redis.new({driver: :celluloid}.merge(configuration.redis_options)) } @redis.with(&block) end
runner()
click to toggle source
# File lib/maxwell/agent.rb, line 24 def runner @runner end
running?()
click to toggle source
# File lib/maxwell/agent.rb, line 58 def running? runner.alive? end
start()
click to toggle source
# File lib/maxwell/agent.rb, line 37 def start if dead_runner? @runner = Runner.run end end
start!()
click to toggle source
# File lib/maxwell/agent.rb, line 43 def start! if dead_runner? @runner = Runner.run! end end
stop()
click to toggle source
# File lib/maxwell/agent.rb, line 49 def stop runner.terminate end
stopped?()
click to toggle source
# File lib/maxwell/agent.rb, line 62 def stopped? !running? end
Private Class Methods
cleanup_dead_runner()
click to toggle source
# File lib/maxwell/agent.rb, line 84 def cleanup_dead_runner if dead_runner? @runner = nil end end
dead_runner?()
click to toggle source
# File lib/maxwell/agent.rb, line 76 def dead_runner? if runner && runner.alive? false else true end end