Sha256: e8ae169f40a82a6f13509080a611a99447593a46644b4752f95a835e83d0d8be

Contents?: true

Size: 1.16 KB

Versions: 18

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

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

    class << self
      # Sets up all the internal components and bootstrap whole app
      # We need to know details about consumers in order to setup components,
      # that's why we don't setup them after std setup is done
      # @raise [Karafka::Errors::InvalidConfiguration] raised when configuration
      #   doesn't match with ConfigurationSchema
      def boot!
        Setup::Config.validate!
        Setup::Config.setup_components
        Callbacks.after_init(Karafka::App.config)
      end

      # @return [Karafka::Routing::Builder] consumers builder instance
      def consumer_groups
        Routing::Builder.instance
      end

      Status.instance_methods(false).each do |delegated|
        define_method(delegated) do
          Status.instance.send(delegated)
        end
      end

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
karafka-1.2.13 lib/karafka/app.rb
karafka-1.2.12 lib/karafka/app.rb
karafka-1.2.11 lib/karafka/app.rb
karafka-1.2.10 lib/karafka/app.rb
karafka-1.2.9 lib/karafka/app.rb
karafka-1.2.8 lib/karafka/app.rb
karafka-1.2.7 lib/karafka/app.rb
karafka-1.2.6 lib/karafka/app.rb
karafka-1.2.5 lib/karafka/app.rb
karafka-1.2.4 lib/karafka/app.rb
karafka-1.2.3 lib/karafka/app.rb
karafka-1.2.2 lib/karafka/app.rb
karafka-1.2.1 lib/karafka/app.rb
karafka-1.2.0 lib/karafka/app.rb
karafka-1.2.0.beta4 lib/karafka/app.rb
karafka-1.2.0.beta3 lib/karafka/app.rb
karafka-1.2.0.beta2 lib/karafka/app.rb
karafka-1.2.0.beta1 lib/karafka/app.rb