pub struct OperationRetries { /* private fields */ }Expand description
How long the client keeps asking for an operation a server has not accepted yet.
The client retries an answer that says “not now” - a broker that is still coming up, a
producer or a consumer the topic already has - rather than reporting it, and by default it
retries for ever, five seconds apart. That is what waits out a broker restart, and it is also
what makes a subscription a server refuses (an
Exclusive one another consumer holds) a call that
never returns. attempts puts a number on it.
The bound covers every retried operation of the connection, the consumer’s own reconnect included, so a service that shortens it trades waiting out an outage for hearing about it.
§Examples
use std::time::Duration;
use ruststream_pulsar::prelude::*;
#[ruststream::app]
fn app() -> impl App {
// Three tries a second apart, then startup reports what the server said instead of
// waiting for the holder of the exclusive subscription to leave.
let retries = OperationRetries::attempts(nonzero!(3u32)).delay(Duration::from_secs(1));
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
PulsarBroker::new("pulsar://localhost:6650").operation_retries(retries),
|b| {
b.include(handle);
},
)
}Implementations§
Source§impl OperationRetries
impl OperationRetries
Trait Implementations§
Source§impl Clone for OperationRetries
impl Clone for OperationRetries
Source§impl Debug for OperationRetries
impl Debug for OperationRetries
Source§impl Default for OperationRetries
impl Default for OperationRetries
impl Eq for OperationRetries
Source§impl From<OperationRetries> for OperationRetryOptions
impl From<OperationRetries> for OperationRetryOptions
Source§fn from(retries: OperationRetries) -> Self
fn from(retries: OperationRetries) -> Self
The client counts the retries that follow the first try, so a bound of n tries is
n - 1 retries.
Source§impl PartialEq for OperationRetries
impl PartialEq for OperationRetries
impl StructuralPartialEq for OperationRetries
Auto Trait Implementations§
impl Freeze for OperationRetries
impl RefUnwindSafe for OperationRetries
impl Send for OperationRetries
impl Sync for OperationRetries
impl Unpin for OperationRetries
impl UnsafeUnpin for OperationRetries
impl UnwindSafe for OperationRetries
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.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