[][src]Trait datastreamcorelib::pubsub::PubSubManager

pub trait PubSubManager {
    fn subscribe(&mut self, sub: &Subscription) -> Fallible<()>;
fn get_subscriptions(&self) -> &Vec<Subscription>;
fn get_default_pub_socket(&self) -> &Option<ZMQSocketArc>; fn dispatch(&self, psmsg: PubSubMessage) { ... }
fn publish_to_socket<T: PubSubMessageMarker + Debug>(
        &self,
        msg: &T,
        socket: &ZMQSocketArc
    ) -> Fallible<()> { ... }
fn publish<T: PubSubMessageMarker + Debug>(&self, msg: &T) -> Fallible<()> { ... } }

Generic traits any PUB/SUB manager should implement

Required methods

fn subscribe(&mut self, sub: &Subscription) -> Fallible<()>

Add subscription to the manager

fn get_subscriptions(&self) -> &Vec<Subscription>

Return the list of subscriptons

fn get_default_pub_socket(&self) -> &Option<ZMQSocketArc>

Get the default publish socket (if available)

Loading content...

Provided methods

fn dispatch(&self, psmsg: PubSubMessage)

Dispatch message to matching subscribers

fn publish_to_socket<T: PubSubMessageMarker + Debug>(
    &self,
    msg: &T,
    socket: &ZMQSocketArc
) -> Fallible<()>

Publish a message (anything with pubsub marker) to given socket Usually you would just use .publish() instead

fn publish<T: PubSubMessageMarker + Debug>(&self, msg: &T) -> Fallible<()>

Publish a message (anything with pubsub marker) to default socket

Loading content...

Implementors

Loading content...