class Karafka::Params::ParamsBatch

It can be also used when handling really heavy data (in terms of parsing).
process if we have after_fetch that rejects some incoming messages without using params
@note Params internally are lazy loaded before first use. That way we can skip parsing
Params batch represents a set of messages received from Kafka.

def each

Other tags:
    Note: - Invocation of this method will cause loading and parsing each param after another.

Other tags:
    Yieldparam: each - parsed and loaded params instance
def each
  @params_batch.each { |param| yield(param.retrieve!) }
end

def initialize(messages_batch, topic_parser)

Parameters:
  • topic_parser (Class) -- topic parser for unparsing messages values
  • messages_batch (Array) -- messages batch
def initialize(messages_batch, topic_parser)
  @params_batch = messages_batch.map! do |message|
    Karafka::Params::Params.build(message, topic_parser)
  end
end

def last

Returns:
  • (Karafka::Params::Params) - last element after the unparsing process
def last
  @params_batch.last.retrieve!
end

def parsed

Returns:
  • (Array) - returns all the params in a loaded state, so they
def parsed
  each(&:itself)
end

def to_a

Returns:
  • (Array) - pure array with params (not parsed)
def to_a
  @params_batch
end