Class: Karafka::Setup::Configurators::Base

Inherits:
Object
  • Object
show all
Extended by:
ActiveSupport::DescendantsTracker
Defined in:
lib/karafka/setup/configurators/base.rb

Overview

Karafka has come components that it relies on (like Sidekiq) We need to configure all of them only when the framework was set up. Any class that descends from this one will be automatically invoked upon setup (after it)

Examples:

Configure an Example class

class ExampleConfigurator < Base
  def setup
    ExampleClass.logger = Karafka.logger
    ExampleClass.redis = config.redis
  end
end

Direct Known Subclasses

WaterDrop

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Karafka::Config::Base

Returns configurator for a given component.

Parameters:

  • config (Karafka::Config)

    config instance



24
25
26
# File 'lib/karafka/setup/configurators/base.rb', line 24

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



20
21
22
# File 'lib/karafka/setup/configurators/base.rb', line 20

def config
  @config
end

Instance Method Details

#setupObject

This method needs to be implemented in a subclass

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/karafka/setup/configurators/base.rb', line 29

def setup
  raise NotImplementedError
end