#[non_exhaustive]pub enum KafkaPosition {
Earliest,
Latest,
Timestamp(i64),
Offset {
topic: Option<String>,
partition: i32,
offset: i64,
},
}Expand description
Where a subscription should resume reading.
The stream-wide variants (Earliest, Latest,
Timestamp) apply to every partition currently assigned to this
consumer; Offset names one partition. Build them with the constructors
(earliest, offset, …) - the variants are what the
seeker matches on.
§Examples
A read model rebuilt from the start of the retained log on every startup, whatever the group committed before:
use ruststream_rdkafka::prelude::*;
#[subscriber(
KafkaTopic::new("orders").group("orders-projection"),
start_at(KafkaPosition::earliest())
)]
async fn project(order: &Order) -> HandlerOutcome {
tracing::info!(order.id, "projecting");
HandlerOutcome::ack()
}
fn app() -> RustStream {
RustStream::new(AppInfo::new("projection", "0.1.0"))
.with_broker(KafkaBroker::new(["localhost:9092"]), |b| {
b.include(project);
})
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Earliest
The earliest offset still retained, on every assigned partition.
Latest
The end of the log, on every assigned partition, as the broker reports it while the seek runs: records published after that point arrive normally, everything before is skipped.
Timestamp(i64)
The first record at or after this timestamp (epoch milliseconds), resolved per assigned partition. A partition with no such record resumes at its end.
Offset
An absolute offset on one partition.
Fields
topic: Option<String>The topic, when the position names one. Positioned
captures the delivery’s own topic here; offset leaves it unset,
which repositions that partition index on every assigned topic (one topic being the
usual case).
Implementations§
Source§impl KafkaPosition
impl KafkaPosition
Trait Implementations§
Source§impl Clone for KafkaPosition
impl Clone for KafkaPosition
Source§impl Debug for KafkaPosition
impl Debug for KafkaPosition
impl Eq for KafkaPosition
Source§impl PartialEq for KafkaPosition
impl PartialEq for KafkaPosition
impl StructuralPartialEq for KafkaPosition
Auto Trait Implementations§
impl Freeze for KafkaPosition
impl RefUnwindSafe for KafkaPosition
impl Send for KafkaPosition
impl Sync for KafkaPosition
impl Unpin for KafkaPosition
impl UnsafeUnpin for KafkaPosition
impl UnwindSafe for KafkaPosition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more