Skip to main content

MessageBroker

Trait MessageBroker 

Source
pub trait MessageBroker: Send + Sync {
    // Required methods
    fn publish(&self, msg: Message) -> usize;
    fn subscribe(&self, topic: &str) -> Receiver<Message>;
    fn close(&self);
}
Expand description

Port: fan-out message broker for inter-component pub/sub.

Implementations must be cheaply cloneable (Arc-backed) so callers can hold a handle without worrying about lifetimes.

Required Methods§

Source

fn publish(&self, msg: Message) -> usize

Source

fn subscribe(&self, topic: &str) -> Receiver<Message>

Source

fn close(&self)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§