View Source KafkaEx.Messages.Fetch.Record (kafka_ex v1.0.0-rc.1)
Represents a single record fetched from Kafka.
This struct aligns with Java Kafka client's ConsumerRecord class.
It contains the record payload along with metadata like offset, key,
timestamp, and headers.
Field names align with Java's ConsumerRecord:
topic- the topic namepartition- the partition numberoffset- position in the Kafka partitionkey- the record key (nullable)value- the record content (nullable)timestamp- the record timestamptimestamp_type- :create_time or :log_append_timeheaders- record headers (list ofHeaderstructs)serialized_key_size- size of serialized key in bytes (-1 if nil)serialized_value_size- size of serialized value in bytes (-1 if nil)leader_epoch- the leader epoch (optional, for newer formats)
Summary
Functions
Builds a Record struct from response data.
Gets a header value by key. Returns nil if not found.
Returns true if the record has headers.
Returns true if the record has a non-nil key.
Returns true if the record has a non-nil value.
Returns a TopicPartition struct for this record.
Types
@type t() :: %KafkaEx.Messages.Fetch.Record{ attributes: non_neg_integer() | nil, crc: non_neg_integer() | nil, headers: [KafkaEx.Messages.Header.t()] | nil, key: binary() | nil, leader_epoch: non_neg_integer() | nil, offset: non_neg_integer(), partition: non_neg_integer() | nil, serialized_key_size: integer() | nil, serialized_value_size: integer() | nil, timestamp: integer() | nil, timestamp_type: timestamp_type(), topic: String.t() | nil, value: binary() | nil }
@type timestamp_type() :: :create_time | :log_append_time | nil
Functions
Builds a Record struct from response data.
Gets a header value by key. Returns nil if not found.
Returns true if the record has headers.
Returns true if the record has a non-nil key.
Returns true if the record has a non-nil value.
@spec topic_partition(t()) :: KafkaEx.Cluster.TopicPartition.t()
Returns a TopicPartition struct for this record.