Sha256: 4e8af3a226e74eec439dbcf08ccd4a200c4d07dd09d8d7ddcfe798428a93b11e

Contents?: true

Size: 1.03 KB

Versions: 9

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Karafka
  # App class
  class App
    extend Setup::Dsl

    class << self
      # @return [Karafka::Routing::Builder] consumers builder instance alias
      def consumer_groups
        config
          .internal
          .routing_builder
      end

      # @return [Array<Karafka::Routing::SubscriptionGroup>] active subscription groups
      def subscription_groups
        consumer_groups
          .active
          .flat_map(&:subscription_groups)
      end

      # Just a nicer name for the consumer groups
      alias routes consumer_groups

      Status.instance_methods(false).each do |delegated|
        define_method(delegated) do
          App.config.internal.status.send(delegated)
        end
      end

      # Methods that should be delegated to Karafka module
      %i[
        root
        env
        logger
        producer
        monitor
        pro?
      ].each do |delegated|
        define_method(delegated) do
          Karafka.send(delegated)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
karafka-2.0.0.beta4 lib/karafka/app.rb
karafka-2.0.0.beta3 lib/karafka/app.rb
karafka-2.0.0.beta2 lib/karafka/app.rb
karafka-2.0.0.beta1 lib/karafka/app.rb
karafka-2.0.0.alpha6 lib/karafka/app.rb
karafka-2.0.0.alpha5 lib/karafka/app.rb
karafka-2.0.0.alpha4 lib/karafka/app.rb
karafka-2.0.0.alpha3 lib/karafka/app.rb
karafka-2.0.0.alpha2 lib/karafka/app.rb