Sha256: 9169f757ef8f1b9fa557cda03d45e69cf205dbfb236a0be6a9689b7f85aa756c

Contents?: true

Size: 743 Bytes

Versions: 2

Compression:

Stored size: 743 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module Web
    module Tracking
      # Base reporter from which all the reports should inherit
      class Reporter
        include ::Karafka::Core::Helpers::Time

        # Can this reporter report. Since some reporters may report only in part of the processes
        # where Karafka is used (like `karafka server`) each may implement more complex rules.
        #
        # The basic is not to report unless we have a producer and this producer is active
        #
        # @return [Boolean]
        def active?
          return false unless ::Karafka::Web.producer
          return false unless ::Karafka::Web.producer.status.active?

          true
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
karafka-web-0.7.10 lib/karafka/web/tracking/reporter.rb
karafka-web-0.7.9 lib/karafka/web/tracking/reporter.rb