Sha256: 4bb04cfee68f1eded91575a6cd46562cfb3eb31c1b7edbf5dad6dc2795676177

Contents?: true

Size: 1.04 KB

Versions: 25

Compression:

Stored size: 1.04 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

25 entries across 25 versions & 1 rubygems

Version Path
karafka-2.0.17 lib/karafka/app.rb
karafka-2.0.16 lib/karafka/app.rb
karafka-2.0.15 lib/karafka/app.rb
karafka-2.0.14 lib/karafka/app.rb
karafka-2.0.13 lib/karafka/app.rb
karafka-2.0.12 lib/karafka/app.rb
karafka-2.0.11 lib/karafka/app.rb
karafka-2.0.10 lib/karafka/app.rb
karafka-2.0.9 lib/karafka/app.rb
karafka-2.0.8 lib/karafka/app.rb
karafka-2.0.7 lib/karafka/app.rb
karafka-2.0.6 lib/karafka/app.rb
karafka-2.0.5 lib/karafka/app.rb
karafka-2.0.4 lib/karafka/app.rb
karafka-2.0.3 lib/karafka/app.rb
karafka-2.0.2 lib/karafka/app.rb
karafka-2.0.1 lib/karafka/app.rb
karafka-2.0.0 lib/karafka/app.rb
karafka-2.0.0.rc6 lib/karafka/app.rb
karafka-2.0.0.rc5 lib/karafka/app.rb