Class: Karafka::Routing::Features::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/routing/features/base.rb,
lib/karafka/routing/features/base/expander.rb

Overview

Base for all the features

Defined Under Namespace

Classes: Expander

Class Method Summary collapse

Class Method Details

.activateObject

Extends topic and builder with given feature API



15
16
17
18
19
20
21
22
# File 'lib/karafka/routing/features/base.rb', line 15

def activate
  Topic.prepend(self::Topic) if const_defined?('Topic', false)
  Topics.prepend(self::Topics) if const_defined?('Topics', false)
  ConsumerGroup.prepend(self::ConsumerGroup) if const_defined?('ConsumerGroup', false)
  Proxy.prepend(self::Proxy) if const_defined?('Proxy', false)
  Builder.prepend(self::Builder) if const_defined?('Builder', false)
  Builder.prepend(Base::Expander.new(self)) if const_defined?('Contracts', false)
end

.load_allObject

Loads all the features and activates them



25
26
27
# File 'lib/karafka/routing/features/base.rb', line 25

def load_all
  features.each(&:activate)
end

.post_setup_all(config) ⇒ Object

Runs post setup routing features configuration operations

Parameters:

  • config (Karafka::Core::Configurable::Node)


38
39
40
# File 'lib/karafka/routing/features/base.rb', line 38

def post_setup_all(config)
  features.each { |feature| feature.post_setup(config) }
end

.pre_setup_all(config) ⇒ Object

Parameters:

  • config (Karafka::Core::Configurable::Node)

    app config that we can alter with particular routing feature specific stuff if needed



31
32
33
# File 'lib/karafka/routing/features/base.rb', line 31

def pre_setup_all(config)
  features.each { |feature| feature.pre_setup(config) }
end