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/coercable.rb,
lib/maxwell/agent/scheduler.rb,
lib/maxwell/agent/attributes.rb,
lib/maxwell/agent/web_helpers.rb,
lib/maxwell/agent/host/service.rb,
lib/maxwell/agent/configuration.rb,
lib/maxwell/agent/redis_objects.rb,
lib/maxwell/agent/work_schedule.rb,
lib/maxwell/agent/evented_worker.rb,
lib/maxwell/agent/standard_worker.rb,
lib/maxwell/agent/middleware/chain.rb,
lib/maxwell/agent/middleware_runner.rb,
lib/maxwell/agent/redis_objects/set.rb,
lib/maxwell/agent/middleware/logging.rb,
lib/maxwell/agent/redis_objects/sorted_set.rb

Defined Under Namespace

Modules: Coercable, Middleware, Probe, RedisObjects, WebHelpers, Work Classes: Attributes, Configuration, EventedWorker, Host, MiddlewareRunner, Runner, Scheduler, StandardWorker, Web, WorkSchedule, Worker

Constant Summary collapse

VERSION =
"0.0.7"

Class Method Summary collapse

Class Method Details

.configurationObject



28
29
30
# File 'lib/maxwell/agent.rb', line 28

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



32
33
34
35
# File 'lib/maxwell/agent.rb', line 32

def configure
  yield configuration if block_given?
  configuration
end

.middleware {|configuration.middleware_chain| ... } ⇒ Object

Yields:



53
54
55
56
# File 'lib/maxwell/agent.rb', line 53

def middleware
  yield configuration.middleware_chain if block_given?
  configuration.middleware_chain
end

.redis(&block) ⇒ Object



66
67
68
69
70
71
72
# 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

.runnerObject



24
25
26
# File 'lib/maxwell/agent.rb', line 24

def runner
  @runner
end

.running?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/maxwell/agent.rb', line 58

def running?
  runner.alive?
end

.startObject



37
38
39
40
41
# File 'lib/maxwell/agent.rb', line 37

def start
  if dead_runner?
    @runner = Runner.run
  end
end

.start!Object



43
44
45
46
47
# File 'lib/maxwell/agent.rb', line 43

def start!
  if dead_runner?
    @runner = Runner.run!
  end
end

.stopObject



49
50
51
# File 'lib/maxwell/agent.rb', line 49

def stop
  runner.terminate
end

.stopped?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/maxwell/agent.rb', line 62

def stopped?
  !running?
end