Method: ComponentHost::Host#start_components

Defined in:
lib/component_host/host.rb

#start_components(&block) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/component_host/host.rb', line 82

def start_components(&block)
  components.each do |component|
    if ComponentHost::Defaults.startup_info?
      STDOUT.puts "  Component: #{component.initiator} (Name: #{component.name || '(none)'})"
    end

    logger.trace(tags: [:component_host, :start]) { "Starting component: #{component.initiator} (Name: #{component.name || '(none)'})" }

    component.start

    logger.info(tags: [:component_host, :start]) { "Started component: #{component.initiator} (Name: #{component.name || '(none)'})" }

    block.(component) if block
  end

rescue => error
  record_errors_observer.(error)
  logger.fatal(tags: [:*, :component_host, :start]) { "#{error.message} (Error: #{error.class})" }
  raise error
end