Module: Karafka::Messages::Builders::Messages

Defined in:
lib/karafka/messages/builders/messages.rb

Overview

Builder for creating message batch instances.

Class Method Summary collapse

Class Method Details

.call(messages, topic, received_at) ⇒ Karafka::Messages::Messages

Creates messages batch with messages inside based on the incoming messages and the topic from which it comes.

Parameters:

Returns:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/karafka/messages/builders/messages.rb', line 16

def call(messages, topic, received_at)
  # We cannot freeze the batch metadata because it is altered with the processed_at time
  # prior to the consumption. It is being frozen there
   = BatchMetadata.call(
    messages,
    topic,
    received_at
  )

  Karafka::Messages::Messages.new(
    messages,
    
  ).freeze
end