Skip to main content

fetch_partition

Function fetch_partition 

Source
pub async fn fetch_partition(
    conn: &Connection,
    topic: &str,
    topic_id: Uuid,
    partition: i32,
    fetch_offset: i64,
    max_wait: Time,
    partition_max: ByteSize,
) -> Result<Vec<FetchedRecord>, ClientError>
Expand description

Fetch up to partition_max from (topic, partition) at fetch_offset.

This function decodes every v2 RecordBatch into FetchedRecords and returns them in offset order. An empty result means the partition had nothing at or after fetch_offset within max_wait. This function skips legacy (non-v2) message sets.

ยงErrors

Returns ClientError on transport or version-negotiation failure. Returns ClientError::Server when the broker reports a non-zero partition-level error_code, for example OFFSET_OUT_OF_RANGE, NOT_LEADER_OR_FOLLOWER, or UNKNOWN_TOPIC_ID. The caller can then react instead of silently re-fetching the same offset forever.