pub struct NotificationClientPool { /* private fields */ }
Expand description
Notification client pool that manages HTTP and SMTP clients for sending notifications.
Provides a thread-safe way to access and create HTTP and SMTP clients
for sending notifications. It uses a ClientStorage
to hold the clients,
allowing for efficient reuse and management of HTTP and SMTP connections.
Implementations§
Source§impl NotificationClientPool
impl NotificationClientPool
pub fn new() -> Self
Sourcepub async fn get_or_create_http_client(
&self,
retry_policy: &HttpRetryConfig,
) -> Result<Arc<ClientWithMiddleware>, NotificationPoolError>
pub async fn get_or_create_http_client( &self, retry_policy: &HttpRetryConfig, ) -> Result<Arc<ClientWithMiddleware>, NotificationPoolError>
Sourcepub async fn get_or_create_smtp_client(
&self,
smtp_config: &SmtpConfig,
) -> Result<Arc<SmtpTransport>, NotificationPoolError>
pub async fn get_or_create_smtp_client( &self, smtp_config: &SmtpConfig, ) -> Result<Arc<SmtpTransport>, NotificationPoolError>
Get or create an SMTP client for sending emails.
§Arguments
smtp_config
- Configuration for the SMTP client, including host, port, username, and password.
§Returns
Result<Arc<SmtpTransport>, NotificationPoolError>
- The SMTP client wrapped in anArc
for shared ownership, or an error if client creation fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NotificationClientPool
impl !RefUnwindSafe for NotificationClientPool
impl Send for NotificationClientPool
impl Sync for NotificationClientPool
impl Unpin for NotificationClientPool
impl !UnwindSafe for NotificationClientPool
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
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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