You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: with_long_living_buffer_spec.rb
    path of file: ./repos/karafka/spec/integrations/consumption
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

# Karafka should allow to create a long living buffer that we can use and fill as we go, beyond
# a single batch of data

# This will force several batches, so we won't end up with 1 huge as this is not what we want here
setup_karafka { |config| config.max
    
  def initialize
    super
    # Karafka never uses same consumer instance for multiple partitions of the same topic, thus we
    # do not need thread safe structures here
    @buffer = []
    @batches = 0
  end

  def consume
    @batches += 1

    messages.each do
      DT[0] << true
    end

    @buffer << messages.raw_payloads
  end

  # Transfer the buffer data outside of the consumer
  def shutdown
    DT[:batches] = @batches
    DT[:buffer] = @buffer
  end
end