Sha256: d056c04a52cb24a320f354b29cec30d96ea75f44c520b2bd15e6419ec191edac

Contents?: true

Size: 911 Bytes

Versions: 9

Compression:

Stored size: 911 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module Params
    module Builders
      # Builder for creating params batch instances
      module ParamsBatch
        class << self
          # Creates params batch with params inside based on the incoming messages
          # and the topic from which it comes
          # @param kafka_messages [Array<Kafka::FetchedMessage>] raw fetched messages
          # @param topic [Karafka::Routing::Topic] topic for which we're received messages
          # @return [Karafka::Params::ParamsBatch<Karafka::Params::Params>] batch with params
          def from_kafka_messages(kafka_messages, topic)
            params_array = kafka_messages.map! do |message|
              Karafka::Params::Builders::Params.from_kafka_message(message, topic)
            end

            Karafka::Params::ParamsBatch.new(params_array)
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
karafka-1.3.7 lib/karafka/params/builders/params_batch.rb
karafka-1.3.6 lib/karafka/params/builders/params_batch.rb
karafka-1.3.5 lib/karafka/params/builders/params_batch.rb
karafka-1.3.4 lib/karafka/params/builders/params_batch.rb
karafka-1.3.3 lib/karafka/params/builders/params_batch.rb
karafka-1.3.2 lib/karafka/params/builders/params_batch.rb
karafka-1.3.1 lib/karafka/params/builders/params_batch.rb
karafka-1.3.0 lib/karafka/params/builders/params_batch.rb
karafka-1.3.0.rc1 lib/karafka/params/builders/params_batch.rb