Sha256: 1335f455c5310c24752b383370b6bd5eaeb5f0eba48673d40c9cfed2aba13399

Contents?: true

Size: 1.28 KB

Versions: 60

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

module Karafka
  module Routing
    module Features
      class Declaratives < Base
        # Extension for managing Kafka topic configuration
        module Topic
          # @param active [Boolean] is the topic structure management feature active
          # @param partitions [Integer]
          # @param replication_factor [Integer]
          # @param details [Hash] extra configuration for the topic
          # @return [Config] defined structure
          def config(active: true, partitions: 1, replication_factor: 1, **details)
            @declaratives ||= Config.new(
              active: active,
              partitions: partitions,
              replication_factor: replication_factor,
              details: details
            )
          end

          # @return [Config] config details
          def declaratives
            config
          end

          # @return [true] declaratives is always active
          def declaratives?
            declaratives.active?
          end

          # @return [Hash] topic with all its native configuration options plus declaratives
          #   settings
          def to_h
            super.merge(
              declaratives: declaratives.to_h
            ).freeze
          end
        end
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
karafka-2.4.13 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.12 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.11 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.10 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.9 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.8 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.7 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.6 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.5 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.4 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.3 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.0 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.0.rc1 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.3.4 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.0.beta2 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.4.0.beta1 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.3.3 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.3.2 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.3.1 lib/karafka/routing/features/declaratives/topic.rb
karafka-2.3.0 lib/karafka/routing/features/declaratives/topic.rb