Trait mongodb::event::cmap::CmapEventHandler [−][src]
Applications can implement this trait to specify custom logic to run on each CMAP event sent by the driver.
struct FailedCheckoutLogger; impl CmapEventHandler for FailedCheckoutLogger { fn handle_connection_checkout_failed_event(&self, event: ConnectionCheckoutFailedEvent) { eprintln!("Failed connection checkout: {:?}", event); } } let handler: Arc<dyn CmapEventHandler> = Arc::new(FailedCheckoutLogger); let options = ClientOptions::builder() .cmap_event_handler(handler) .build(); let client = Client::with_options(options)?; // Do things with the client, and failed connection pool checkouts will be logged to stderr.
Provided methods
fn handle_pool_created_event(&self, _event: PoolCreatedEvent)
[src]
A Client
will call this method on each registered handler
whenever a connection pool is created.
fn handle_pool_ready_event(&self, _event: PoolReadyEvent)
[src]
A Client
will call this method on each registered handler
whenever a connection pool marked as ready for use.
Connections may not be created by or checked out from the pool until it has been marked as ready.
fn handle_pool_cleared_event(&self, _event: PoolClearedEvent)
[src]
A Client
will call this method on each registered handler
whenever a connection pool is cleared.
fn handle_pool_closed_event(&self, _event: PoolClosedEvent)
[src]
A Client
will call this method on each registered handler
whenever a connection pool is cleared.
fn handle_connection_created_event(&self, _event: ConnectionCreatedEvent)
[src]
A Client
will call this method on each registered handler
whenever a connection is created.
fn handle_connection_ready_event(&self, _event: ConnectionReadyEvent)
[src]
A Client
will call this method on each registered handler
whenever a connection is ready to be used.
fn handle_connection_closed_event(&self, _event: ConnectionClosedEvent)
[src]
A Client
will call this method on each registered handler
whenever a connection is closed.
fn handle_connection_checkout_started_event(
&self,
_event: ConnectionCheckoutStartedEvent
)
[src]
&self,
_event: ConnectionCheckoutStartedEvent
)
A Client
will call this method on each registered handler
whenever a thread begins checking out a connection to use for an operation.
fn handle_connection_checkout_failed_event(
&self,
_event: ConnectionCheckoutFailedEvent
)
[src]
&self,
_event: ConnectionCheckoutFailedEvent
)
A Client
will call this method on each registered handler
whenever a thread is unable to check out a connection.
fn handle_connection_checked_out_event(&self, _event: ConnectionCheckedOutEvent)
[src]
A Client
will call this method on each registered handler
whenever a connection is successfully checked out.
fn handle_connection_checked_in_event(&self, _event: ConnectionCheckedInEvent)
[src]
A Client
will call this method on each registered handler
whenever a connection is checked back into a connection pool.