pub struct ConsumerOffsetOutOfRangeError { /* private fields */ }Expand description
A fetch asked for an offset outside the range the broker retains.
Corresponds to Java’s org.apache.kafka.clients.consumer.OffsetOutOfRangeException.
It has no entry in Errors, so it carries no protocol code — the wire code
OFFSET_OUT_OF_RANGE builds the common.errors class instead.
Java extends chain:
OffsetOutOfRangeException -> InvalidOffsetException -> KafkaException
Implementations§
Source§impl ConsumerOffsetOutOfRangeError
impl ConsumerOffsetOutOfRangeError
Sourcepub fn new(offset_out_of_range_partitions: HashMap<TopicPartition, i64>) -> Self
pub fn new(offset_out_of_range_partitions: HashMap<TopicPartition, i64>) -> Self
Create the error, mirroring Java’s
OffsetOutOfRangeException(Map<TopicPartition, Long>).
Sourcepub fn with_message(
message: impl Into<String>,
offset_out_of_range_partitions: HashMap<TopicPartition, i64>,
) -> Self
pub fn with_message( message: impl Into<String>, offset_out_of_range_partitions: HashMap<TopicPartition, i64>, ) -> Self
Create the error with a caller-supplied message, mirroring Java’s
OffsetOutOfRangeException(String, Map<TopicPartition, Long>).
Sourcepub fn offset_out_of_range_partitions(&self) -> &HashMap<TopicPartition, i64>
pub fn offset_out_of_range_partitions(&self) -> &HashMap<TopicPartition, i64>
The out-of-range offset per partition.
Sourcepub fn partitions(&self) -> impl Iterator<Item = &TopicPartition>
pub fn partitions(&self) -> impl Iterator<Item = &TopicPartition>
The partitions this error covers.
Mirrors Java’s OffsetOutOfRangeException.partitions()
(OffsetOutOfRangeException.java:51-54), which is
return offsetOutOfRangePartitions.keySet(); — the override of the
single abstract member InvalidOffsetException declares
(InvalidOffsetException.java:36), so it is available uniformly across
the family that
is_consumer_invalid_offset_error
recognises.
Returns an iterator rather than a HashSet: Java’s keySet() is a
view over the map, so materialising a set here would allocate where
Java does not (CLAUDE.md §13/§14).
Trait Implementations§
Source§impl Clone for ConsumerOffsetOutOfRangeError
impl Clone for ConsumerOffsetOutOfRangeError
Source§fn clone(&self) -> ConsumerOffsetOutOfRangeError
fn clone(&self) -> ConsumerOffsetOutOfRangeError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more