Class: Karafka::Setup::Config

Inherits:
Object
  • Object
show all
Extended by:
Core::Configurable
Defined in:
lib/karafka/setup/config.rb

Overview

Note:

If you want to do some configurations after all of this is done, please add to karafka/config a proper file (needs to inherit from Karafka::Setup::Configurators::Base and implement setup method) after that everything will happen automatically

Note:

This config object allows to create a 1 level nesting (nodes) only. This should be enough and will still keep the code simple

Configurator for setting up all the framework details that are required to make it work

See Also:

  • for more details about configurators api

Class Method Summary collapse

Class Method Details

.setup(&block) ⇒ Object

Configuring method

Parameters:

  • block (Proc)

    block we want to execute with the config instance



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/karafka/setup/config.rb', line 240

def setup(&block)
  # Will prepare and verify license if present
  Licenser.prepare_and_verify(config.license)

  # Pre-setup configure all routing features that would need this
  Routing::Features::Base.pre_setup_all(config)

  # Will configure all the pro components
  # This needs to happen before end user configuration as the end user may overwrite some
  # of the pro defaults with custom components
  Pro::Loader.pre_setup_all(config) if Karafka.pro?

  configure(&block)
  merge_kafka_defaults!(config)

  Contracts::Config.new.validate!(config.to_h)

  configure_components

  # Refreshes the references that are cached that might have been changed by the config
  ::Karafka.refresh!

  # Post-setup configure all routing features that would need this
  Routing::Features::Base.post_setup_all(config)

  # Runs things that need to be executed after config is defined and all the components
  # are also configured
  Pro::Loader.post_setup_all(config) if Karafka.pro?

  Karafka::App.initialized!
end