Method: Kafka::FetchOperation#fetch_from_partition

Defined in:
lib/kafka/fetch_operation.rb

#fetch_from_partition(topic, partition, offset: :latest, max_bytes: 1048576) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/kafka/fetch_operation.rb', line 37

def fetch_from_partition(topic, partition, offset: :latest, max_bytes: 1048576)
  if offset == :earliest
    offset = -2
  elsif offset == :latest
    offset = -1
  end

  @topics[topic] ||= {}
  @topics[topic][partition] = {
    fetch_offset: offset,
    max_bytes: max_bytes,
  }
end