Class: Euston::Daemons::Pipeline::DaemonEnvironment

Inherits:
Euston::DaemonEnvironment show all
Defined in:
lib/euston-daemons/pipeline/config/environment.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ DaemonEnvironment

Returns a new instance of DaemonEnvironment.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 40

def initialize data
  @logger             = data[:logger]
  @daemon_config      = data[:daemon_config]
  if data.has_key?(:app_root) && @daemon_config.has_key?(:i18n_locales_path)
    @i18n_locales_path  = File.join(data[:app_root], @daemon_config[:i18n_locales_path], "*")
  end

  @amqp_config  = ErbYaml.read data[:amqp_config_path],   data[:environment]
  @mongo_config = ErbYaml.read data[:mongo_config_path],  data[:environment]

  self.class.command_handler_namespaces       = data[:command_handler_namespaces]
  self.class.event_handler_namespaces         = data[:event_handler_namespaces]
  self.class.user_defined_components          = data[:user_defined_components]

  self.class.command_processors               = @daemon_config[:command_processors].to_i
  self.class.command_loggers                  = @daemon_config[:command_loggers].to_i
  self.class.command_log_ignores              = @daemon_config[:command_log_ignores]
  self.class.event_processors                 = @daemon_config[:event_processors].to_i
  self.class.event_store_dispatchers          = @daemon_config[:event_store_dispatchers].to_i
  self.class.event_store_dispatcher_wait_time = @daemon_config[:event_store_dispatcher_wait_time].to_f
  self.class.message_buffers                  = @daemon_config[:message_buffers].to_i
  self.class.message_buffer_wait_time         = @daemon_config[:message_buffer_wait_time].to_f
  self.class.snapshotters                     = @daemon_config[:snapshotters].to_i
  self.class.snapshotter_wait_time            = @daemon_config[:snapshotter_wait_time].to_f
  self.class.snapshot_threshold               = @daemon_config[:snapshot_threshold].to_i
end

Class Attribute Details

.command_handler_namespacesObject

Returns the value of attribute command_handler_namespaces.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def command_handler_namespaces
  @command_handler_namespaces
end

.command_log_ignoresObject

Returns the value of attribute command_log_ignores.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def command_log_ignores
  @command_log_ignores
end

.command_loggersObject

Returns the value of attribute command_loggers.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def command_loggers
  @command_loggers
end

.command_processorsObject

Returns the value of attribute command_processors.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def command_processors
  @command_processors
end

.event_handler_namespacesObject

Returns the value of attribute event_handler_namespaces.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def event_handler_namespaces
  @event_handler_namespaces
end

.event_processorsObject

Returns the value of attribute event_processors.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def event_processors
  @event_processors
end

.event_store_dispatcher_wait_timeObject

Returns the value of attribute event_store_dispatcher_wait_time.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def event_store_dispatcher_wait_time
  @event_store_dispatcher_wait_time
end

.event_store_dispatchersObject

Returns the value of attribute event_store_dispatchers.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def event_store_dispatchers
  @event_store_dispatchers
end

.message_buffer_wait_timeObject

Returns the value of attribute message_buffer_wait_time.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def message_buffer_wait_time
  @message_buffer_wait_time
end

.message_buffersObject

Returns the value of attribute message_buffers.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def message_buffers
  @message_buffers
end

.snapshot_thresholdObject

Returns the value of attribute snapshot_threshold.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def snapshot_threshold
  @snapshot_threshold
end

.snapshotter_wait_timeObject

Returns the value of attribute snapshotter_wait_time.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def snapshotter_wait_time
  @snapshotter_wait_time
end

.snapshottersObject

Returns the value of attribute snapshotters.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def snapshotters
  @snapshotters
end

.user_defined_componentsObject

Returns the value of attribute user_defined_components.



24
25
26
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 24

def user_defined_components
  @user_defined_components
end

Instance Method Details

#setupObject



67
68
69
70
71
72
73
74
75
76
# File 'lib/euston-daemons/pipeline/config/environment.rb', line 67

def setup
  setup_safely @daemon_config[:hoptoad_key]
  setup_amqp @amqp_config
  setup_mongo @mongo_config
  setup_euston @mongo_config[:event_store_database]

  I18n.load_path += Dir.glob(@i18n_locales_path) unless @i18n_locales_path.nil?

  self.class
end