pub struct EventBus { /* private fields */ }Expand description
Event bus for TAP HTTP server
Implementations§
Source§impl EventBus
impl EventBus
Sourcepub fn subscribe<S>(&self, subscriber: S)where
S: EventSubscriber + 'static,
pub fn subscribe<S>(&self, subscriber: S)where
S: EventSubscriber + 'static,
Subscribe to HTTP events with a boxed subscriber
Sourcepub fn unsubscribe(&self, subscriber: &Arc<Box<dyn EventSubscriber>>)
pub fn unsubscribe(&self, subscriber: &Arc<Box<dyn EventSubscriber>>)
Remove a subscriber from the event bus
Sourcepub async fn publish_server_started(&self, address: String)
pub async fn publish_server_started(&self, address: String)
Publish a server started event
Sourcepub async fn publish_server_stopped(&self)
pub async fn publish_server_stopped(&self)
Publish a server stopped event
Sourcepub async fn publish_request_received(
&self,
method: String,
path: String,
client_ip: Option<String>,
)
pub async fn publish_request_received( &self, method: String, path: String, client_ip: Option<String>, )
Publish a request received event
Sourcepub async fn publish_response_sent(
&self,
status: StatusCode,
size: usize,
duration_ms: u64,
)
pub async fn publish_response_sent( &self, status: StatusCode, size: usize, duration_ms: u64, )
Publish a response sent event
Sourcepub async fn publish_message_received(
&self,
id: String,
type_: String,
from: Option<String>,
to: Option<String>,
)
pub async fn publish_message_received( &self, id: String, type_: String, from: Option<String>, to: Option<String>, )
Publish a DIDComm message received event
Sourcepub async fn publish_message_error(
&self,
error_type: String,
message: String,
message_id: Option<String>,
)
pub async fn publish_message_error( &self, error_type: String, message: String, message_id: Option<String>, )
Publish a DIDComm message processing error event
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
Get the number of subscribers (for testing)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for EventBus
impl RefUnwindSafe for EventBus
impl Send for EventBus
impl Sync for EventBus
impl Unpin for EventBus
impl UnsafeUnpin for EventBus
impl UnwindSafe for EventBus
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> 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