Module: Karafka::Routing::Features::Declaratives::Topic

Defined in:
lib/karafka/routing/features/declaratives/topic.rb

Overview

Extension for managing Kafka topic configuration

Instance Method Summary collapse

Instance Method Details

#config(active: true, partitions: 1, replication_factor: 1, **details) ⇒ Config

Returns defined structure.

Parameters:

  • active (Boolean) (defaults to: true)

    is the topic structure management feature active

  • partitions (Integer) (defaults to: 1)
  • replication_factor (Integer) (defaults to: 1)
  • details (Hash)

    extra configuration for the topic

Returns:

  • (Config)

    defined structure



14
15
16
17
18
19
20
21
# File 'lib/karafka/routing/features/declaratives/topic.rb', line 14

def config(active: true, partitions: 1, replication_factor: 1, **details)
  @declaratives ||= Config.new(
    active: active,
    partitions: partitions,
    replication_factor: replication_factor,
    details: details
  )
end

#declarativesConfig

Returns config details.

Returns:



24
25
26
# File 'lib/karafka/routing/features/declaratives/topic.rb', line 24

def declaratives
  config
end

#declaratives?true

Returns declaratives is always active.

Returns:

  • (true)

    declaratives is always active



29
30
31
# File 'lib/karafka/routing/features/declaratives/topic.rb', line 29

def declaratives?
  declaratives.active?
end

#to_hHash

Returns topic with all its native configuration options plus declaratives settings.

Returns:

  • (Hash)

    topic with all its native configuration options plus declaratives settings



35
36
37
38
39
# File 'lib/karafka/routing/features/declaratives/topic.rb', line 35

def to_h
  super.merge(
    declaratives: declaratives.to_h
  ).freeze
end