Skip to main content

Seeker

Trait Seeker 

Source
pub trait Seeker:
    Clone
    + Send
    + Sync
    + 'static {
    type Position: Send;
    type Error: StdError + Send + Sync + 'static;

    // Required method
    fn seek(
        &self,
        to: Self::Position,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
Expand description

A clonable handle that repositions one subscription, minted by Seekable::seeker.

What one seek covers differs between brokers: a broker whose position lives on the consumer instance (Kafka) moves that instance only, while a broker whose position is a shared group cursor (Redis streams) moves the whole consumer group. Repositioning also invalidates any acknowledgement bookkeeping the broker keeps for the subscription (a contiguous-watermark commit tracker must reset). Broker implementations document both.

Required Associated Types§

Source

type Position: Send

The broker’s own position type (Kafka partition offsets, a Redis entry id, a byte offset), constructed by the broker crate or captured from a delivered message via Positioned::position.

Source

type Error: StdError + Send + Sync + 'static

The error returned when the broker rejects the reposition.

Required Methods§

Source

fn seek( &self, to: Self::Position, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Moves the subscription to to; subsequent deliveries resume from there.

Once the returned future resolves, the next delivery yielded by the subscription reflects the new position. For a position captured from a delivered message the resume point is fixed by the Positioned contract: that message is delivered again. For a position built by a broker constructor (earliest, a timestamp) the resume point is defined by the broker’s own position documentation.

§Errors

Returns Self::Error when the broker rejects the reposition or the transport fails.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§