Sha256: decb421f12d9704ab42ca9d24ddb0e92a30fec5ec0e58569d70f9eb4fc8fbba7

Contents?: true

Size: 1.36 KB

Versions: 6

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

module Karafka
  module Processing
    # Our processing patterns differ depending on various features configurations
    # In this namespace we collect strategies for particular feature combinations to simplify the
    # design. Based on features combinations we can then select handling strategy for a given case.
    #
    # @note The lack of common code here is intentional. It would get complex if there would be
    #   any type of composition, so each strategy is expected to be self-sufficient
    module Strategies
      # Base strategy that should be included in each strategy, just to ensure the API
      module Base
        # What should happen before jobs are enqueued
        # @note This runs from the listener thread, not recommended to put anything slow here
        def handle_before_enqueue
          raise NotImplementedError, 'Implement in a subclass'
        end

        # What should happen before we kick in the processing
        def handle_before_consume
          raise NotImplementedError, 'Implement in a subclass'
        end

        # Post-consumption handling
        def handle_after_consume
          raise NotImplementedError, 'Implement in a subclass'
        end

        # Revocation handling
        def handle_revoked
          raise NotImplementedError, 'Implement in a subclass'
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
karafka-2.0.21 lib/karafka/processing/strategies/base.rb
karafka-2.0.20 lib/karafka/processing/strategies/base.rb
karafka-2.0.19 lib/karafka/processing/strategies/base.rb
karafka-2.0.18 lib/karafka/processing/strategies/base.rb
karafka-2.0.17 lib/karafka/processing/strategies/base.rb
karafka-2.0.16 lib/karafka/processing/strategies/base.rb