use crate::observer::{EventSubject, MsgListener};
use either::Either;
use std::fmt::Debug;
#[derive(Debug)]
pub struct ObserverConfig<ML, ES>
where
ML: MsgListener,
ML::Config: Debug,
ES: EventSubject,
ES::Config: Debug,
{
pub subject_config: ES::Config,
pub broker_config: ML::Config,
}
impl<ML, ES> ObserverConfig<ML, ES>
where
ML: MsgListener,
ML::Config: Debug,
ES: EventSubject,
ES::Config: Debug,
{
pub const fn subject_config(&self) -> &ES::Config {
&self.subject_config
}
pub const fn listener_config(&self) -> &ML::Config {
&self.broker_config
}
pub async fn run_observer(self) -> Result<(), Either<ML::Error, ES::Error>> {
crate::observer::observer_main_loop(self).await
}
}