Class: Maxwell::Agent::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/maxwell/agent/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
13
14
15
16
# File 'lib/maxwell/agent/configuration.rb', line 10

def initialize
  @worker_concurrency = 25
  @middleware_chain = default_middleware
  @work_poll = 1
  @host_configuration = 'config/host_configuration.json'
  @redis_options = { host: 'localhost', port: 6379 }
end

Instance Attribute Details

#host_configurationObject

Returns the value of attribute host_configuration.



6
7
8
# File 'lib/maxwell/agent/configuration.rb', line 6

def host_configuration
  @host_configuration
end

#middleware_chainObject (readonly)

Returns the value of attribute middleware_chain.



8
9
10
# File 'lib/maxwell/agent/configuration.rb', line 8

def middleware_chain
  @middleware_chain
end

#redis_optionsObject

Returns the value of attribute redis_options.



6
7
8
# File 'lib/maxwell/agent/configuration.rb', line 6

def redis_options
  @redis_options
end

#work_pollObject

Returns the value of attribute work_poll.



6
7
8
# File 'lib/maxwell/agent/configuration.rb', line 6

def work_poll
  @work_poll
end

#worker_concurrencyObject

Returns the value of attribute worker_concurrency.



6
7
8
# File 'lib/maxwell/agent/configuration.rb', line 6

def worker_concurrency
  @worker_concurrency
end

Instance Method Details

#default_middlewareObject



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

def default_middleware
  Middleware::Chain.new do |m|
    m.add Middleware::Logging
  end
end

#middleware {|@middleware_chain| ... } ⇒ Object

Yields:



18
19
20
21
22
# File 'lib/maxwell/agent/configuration.rb', line 18

def middleware
  @middleware_chain ||= default_middleware
  yield @middleware_chain if block_given?
  @middleware_chain
end