pub trait BusTap: 'static {
// Required methods
fn on_publish(&self, topic: MStr<Topic>, message: &dyn Any);
fn on_send(&self, endpoint: MStr<Endpoint>, message: &dyn Any);
// Provided method
fn on_response(&self, _correlation_id: &UUID4, _message: &dyn Any) { ... }
}Expand description
Observes dispatched bus traffic for the durable event store.
The bus invokes the registered tap (when present) before each publish, send, or
correlation response fanout, so subscribers cannot observe a message that has not
yet been handed to the tap. The tap callback runs on the engine thread and must be
cheap; it must not re-enter the bus (the bus is single-threaded and the call site
holds no live borrow of the bus, so any re-entrant publish would deadlock through
downstream RefCell::borrow_mut calls inside the registered tap).
Required Methods§
Sourcefn on_publish(&self, topic: MStr<Topic>, message: &dyn Any)
fn on_publish(&self, topic: MStr<Topic>, message: &dyn Any)
Invoked before a publish fanout dispatches to subscribers on topic.
Provided Methods§
Sourcefn on_response(&self, _correlation_id: &UUID4, _message: &dyn Any)
fn on_response(&self, _correlation_id: &UUID4, _message: &dyn Any)
Invoked before a correlation response dispatch reaches the response handler.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".