pub trait MsgListener: Sized + Send + Sync {
    type Config: Send + Sync;
    type Connection;
    type Message: Debug + Send;
    type Error: Error + 'static;

    // Required methods
    fn connect(
        config: &Self::Config
    ) -> impl Future<Output = Result<Self, Self::Error>> + Send;
    fn subscribe_to_notifications(
        &mut self
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn notification_stream(
        &mut self
    ) -> impl Future<Output = Option<Self::Message>> + Send;
    fn get_current_state(
        &mut self
    ) -> impl Future<Output = Result<HashSet<String>, <Self as MsgListener>::Error>> + Send;
}
Expand description

Describes structures capable of listening to a Message Broker system, facilitating dynamic system adjustments based on Message Broker notifications.

Required Associated Types§

source

type Config: Send + Sync

Configuration for connecting to the message broker system.

source

type Connection

Connection interface for the message broker.

source

type Message: Debug + Send

Message type received through the broker.

source

type Error: Error + 'static

Any Error type returned by operations on the message broker.

Required Methods§

source

fn connect( config: &Self::Config ) -> impl Future<Output = Result<Self, Self::Error>> + Send

Establishes connection to the message broker using the provided configuration.

source

fn subscribe_to_notifications( &mut self ) -> impl Future<Output = Result<(), Self::Error>> + Send

Subscribes to notifications, enabling message receipt for state alignments.

source

fn notification_stream( &mut self ) -> impl Future<Output = Option<Self::Message>> + Send

Provides a stream of messages, allowing continuous monitoring and response to broker notifications.

source

fn get_current_state( &mut self ) -> impl Future<Output = Result<HashSet<String>, <Self as MsgListener>::Error>> + Send

Get the current state of a dataset.

Object Safety§

This trait is not object safe.

Implementors§