pub struct EventHub { /* private fields */ }Expand description
Publish/subscribe fan-out for ClientEvent values.
EventHub is used by managed sessions internally and is also exported for
callers that want the same bounded subscription behavior around their own
event producer. Publishing clones each event once per subscriber.
Implementations§
Source§impl EventHub
impl EventHub
Sourcepub fn subscribe(
&self,
config: SubscriberConfig,
) -> Result<EventSubscription, ClientError>
pub fn subscribe( &self, config: SubscriberConfig, ) -> Result<EventSubscription, ClientError>
Register a new subscriber with its own bounded queue.
Returns an error when config.capacity is zero.
Sourcepub fn publish(&self, event: ClientEvent)
pub fn publish(&self, event: ClientEvent)
Publish an event to all currently connected subscribers.
Slow subscribers are handled according to their
SubscriberOverflow policy. Publishing does not block waiting for a
subscriber to consume queued events.
Sourcepub fn disconnect_all(&self)
pub fn disconnect_all(&self)
Disconnect all subscribers after leaving their already queued events available to drain.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventHub
impl RefUnwindSafe for EventHub
impl Send for EventHub
impl Sync for EventHub
impl Unpin for EventHub
impl UnsafeUnpin for EventHub
impl UnwindSafe for EventHub
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