pub struct ConsumerReady<T> { /* private fields */ }Expand description
Stage 3: everything required is present; the rest is optional.
Implementations§
Source§impl<T: Transport> ConsumerReady<T>
impl<T: Transport> ConsumerReady<T>
Sourcepub fn isolation(self, isolation: IsolationLevel) -> Self
pub fn isolation(self, isolation: IsolationLevel) -> Self
Defaults to IsolationLevel::ReadCommitted — the safe end, since
READ_UNCOMMITTED shows records from transactions that later aborted.
Sourcepub fn credentials(self, credentials: Credentials) -> Self
pub fn credentials(self, credentials: Credentials) -> Self
SASL credentials. Pair PLAIN with TLS; it sends the password in the
clear.
Sourcepub fn assign(
self,
topic: impl Into<String>,
partition: i32,
start: StartOffset,
) -> Self
pub fn assign( self, topic: impl Into<String>, partition: i32, start: StartOffset, ) -> Self
Assign a partition and where to start it. Call it once per partition.
Assignment is the caller’s: there is no consumer group and no rebalance, so nothing assigns partitions behind your back.
Sourcepub fn assign_range(
self,
topic: impl Into<String>,
partitions: impl IntoIterator<Item = i32>,
start: StartOffset,
) -> Self
pub fn assign_range( self, topic: impl Into<String>, partitions: impl IntoIterator<Item = i32>, start: StartOffset, ) -> Self
Assign a range of partitions, all starting at the same place.
Sourcepub fn assign_all(self, topic: impl Into<String>, start: StartOffset) -> Self
pub fn assign_all(self, topic: impl Into<String>, start: StartOffset) -> Self
Assign every partition of topic, asking the broker how many there
are.
The count is the one thing about an assignment worth asking for: it
changes when a topic is expanded, and hardcoding it in an
assign_range silently stops consuming the new
partitions. Which partitions this client owns is still the caller’s —
there is no consumer group here, so a process that wants a share of a
topic rather than all of it assigns that share itself.
Resolved once, at build, and that is a real hazard for
a topic you do not own. Adding partitions is how a topic is scaled,
and it is usually done by whoever produces to it. A topic expanded from
8 to 16 partitions after this call leaves partitions 8–15 unread
indefinitely: nothing errors, and the consumer looks healthy while
missing a share of its input.
Until this client can watch for that — see docs/completing-the-client.md,
which is where the fix is scoped — assign_all means all of them as of
now, and a caller reading a topic owned by someone else should poll
Consumer::partition_count and
rebuild when it grows.
Sourcepub fn max_wait(self, max_wait: Duration) -> Self
pub fn max_wait(self, max_wait: Duration) -> Self
How long a fetch waits at the broker for data before coming back empty.
Sourcepub fn prefetch(self, prefetch: bool) -> Self
pub fn prefetch(self, prefetch: bool) -> Self
Keep a fetch permanently in flight, so the broker is already working while the caller processes the last batch. On by default.
Sourcepub fn incremental_fetch(self, incremental: bool) -> Self
pub fn incremental_fetch(self, incremental: bool) -> Self
Incremental fetch sessions (KIP-227). On by default; turn it off for a broker or proxy that mishandles them.