Trait generic_db_observer::observer::MsgListener
source · 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§
sourcetype Connection
type Connection
Connection interface for the message broker.
Required Methods§
sourcefn connect(
config: &Self::Config
) -> impl Future<Output = Result<Self, Self::Error>> + Send
fn connect( config: &Self::Config ) -> impl Future<Output = Result<Self, Self::Error>> + Send
Establishes connection to the message broker using the provided configuration.
sourcefn subscribe_to_notifications(
&mut self
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn subscribe_to_notifications( &mut self ) -> impl Future<Output = Result<(), Self::Error>> + Send
Subscribes to notifications, enabling message receipt for state alignments.
sourcefn notification_stream(
&mut self
) -> impl Future<Output = Option<Self::Message>> + Send
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.
sourcefn get_current_state(
&mut self
) -> impl Future<Output = Result<HashSet<String>, <Self as MsgListener>::Error>> + Send
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.