pub struct RetryManager { /* private fields */ }Expand description
Centralized retry and reconnection management with backoff, jitter, and authentication
Implementations§
Source§impl RetryManager
impl RetryManager
pub fn new( max_retries: usize, base_backoff_ms: u64, max_backoff_ms: u64, ) -> Self
Sourcepub fn max_retries(&self) -> usize
pub fn max_retries(&self) -> usize
Get the maximum number of retries
Sourcepub async fn insert_auth_token<T>(
client: &DanubeClient,
request: &mut Request<T>,
addr: &Uri,
) -> Result<()>
pub async fn insert_auth_token<T>( client: &DanubeClient, request: &mut Request<T>, addr: &Uri, ) -> Result<()>
Insert authentication token into request.
Delegates to [AuthService::insert_token_if_needed].
Sourcepub fn insert_proxy_header<T>(
request: &mut Request<T>,
broker_url: &Uri,
proxy: bool,
)
pub fn insert_proxy_header<T>( request: &mut Request<T>, broker_url: &Uri, proxy: bool, )
Insert proxy routing header into request when proxy mode is active. The proxy uses this header to route the gRPC call to the correct broker.
Sourcepub fn is_retryable_error(&self, error: &DanubeError) -> bool
pub fn is_retryable_error(&self, error: &DanubeError) -> bool
Check if an error is retryable based on gRPC status codes.
Retryable codes:
Unavailable— broker not reachable or topic moved (ServiceNotReady)DeadlineExceeded— request timed outResourceExhausted— rate limited / overloaded
Sourcepub fn calculate_backoff(&self, attempt: usize) -> Duration
pub fn calculate_backoff(&self, attempt: usize) -> Duration
Calculate linear backoff with jitter
Trait Implementations§
Source§impl Clone for RetryManager
impl Clone for RetryManager
Source§fn clone(&self) -> RetryManager
fn clone(&self) -> RetryManager
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RetryManager
impl RefUnwindSafe for RetryManager
impl Send for RetryManager
impl Sync for RetryManager
impl Unpin for RetryManager
impl UnsafeUnpin for RetryManager
impl UnwindSafe for RetryManager
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request