Sha256: 4ae7d80518d2c74c2a2b76747c2fdab500618fbf7ca357525330ad3ab408a8a4

Contents?: true

Size: 1.71 KB

Versions: 19

Compression:

Stored size: 1.71 KB

Contents

# frozen_string_literal: true

require "zeitwerk"
require "karafka"
require "active_record"
require "yabeda"
require "anyway_config"
require "thor"
require "dry/types"
require "dry-struct"

begin
  require "sbmt/outbox"
rescue LoadError
  # sbmt-outbox is an optional dependency
end

require "anyway/rails" if defined?(Rails)
require_relative "kafka_consumer/railtie" if defined?(Rails::Railtie)

module Sbmt
  module KafkaConsumer
    class << self
      delegate :monitor, to: Karafka

      def logger
        @logger ||= Rails.logger
      end
    end

    class Error < StandardError; end

    class SkipUndeserializableMessage < Error; end
  end
end

loader = Zeitwerk::Loader.new
# we need to set parent dir as gem autoloading root
# see https://github.com/fxn/zeitwerk/issues/138#issuecomment-709640940 for details
loader.push_dir(File.join(__dir__, ".."))
loader.tag = "sbmt-kafka_consumer"

# protobuf is an optional dependency
loader.do_not_eager_load("#{__dir__}/kafka_consumer/serialization/protobuf_deserializer.rb")
loader.do_not_eager_load("#{__dir__}/kafka_consumer/instrumentation/open_telemetry_loader.rb")
loader.do_not_eager_load("#{__dir__}/kafka_consumer/instrumentation/open_telemetry_tracer.rb")
loader.do_not_eager_load("#{__dir__}/kafka_consumer/instrumentation/sentry_tracer.rb")

# completely ignore testing helpers
# because testing.rb just requires some files and does not contain any constants (e.g. Testing) which Zeitwerk expects
loader.ignore("#{__dir__}/kafka_consumer/testing.rb")
loader.ignore("#{__dir__}/kafka_consumer/testing")
loader.ignore("#{File.expand_path("../", __dir__)}/generators")

loader.inflector.inflect("cli" => "CLI")
loader.inflector.inflect("version" => "VERSION")

loader.setup
loader.eager_load

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
sbmt-kafka_consumer-3.3.0 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-3.2.2 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-3.2.1 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-3.2.0 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-3.1.0 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.8.0 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-3.0.0 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.7.1 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.7.0 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.6.1 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.6.0 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.5.0 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.4.1 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.4.0 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.3.1 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.3.0 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.2.0 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.1.0 lib/sbmt/kafka_consumer.rb
sbmt-kafka_consumer-2.0.0 lib/sbmt/kafka_consumer.rb