Sha256: 05cd1479516fc8af1e6bd9ad7abe8751f118a1abdcfb90fd3dd52f75951112f5
Contents?: true
Size: 1 KB
Versions: 30
Compression:
Stored size: 1 KB
Contents
module Kafka # An ordered sequence of messages fetched from a Kafka partition. class FetchedBatch # @return [String] attr_reader :topic # @return [Integer] attr_reader :partition # @return [Integer] the offset of the most recent message in the partition. attr_reader :highwater_mark_offset # @return [Array<Kafka::FetchedMessage>] attr_reader :messages def initialize(topic:, partition:, highwater_mark_offset:, messages:) @topic = topic @partition = partition @highwater_mark_offset = highwater_mark_offset @messages = messages end def empty? @messages.empty? end def first_offset if empty? nil else messages.first.offset end end def last_offset if empty? highwater_mark_offset - 1 else messages.last.offset end end def offset_lag if empty? 0 else (highwater_mark_offset - 1) - last_offset end end end end
Version data entries
30 entries across 30 versions & 1 rubygems