/// Starts up environment monitors and returns a TargetedMessenger that
/// broadcasts to all monitors.
Starts up environment monitors and returns a TargetedMessenger that
broadcasts to all monitors.
Starts up environment monitors and returns a TargetedMessenger that broadcasts to all monitors .
pub async fn start_monitoring(&self) -> Result<service::message::TargetedMessenger, Error> {
        // Create unbound, broadcasting messenger to send messages to the monitors.
        let monitor_messenger = service::message::TargetedMessenger::new(
            self.delegate
                .create(MessengerType::Unbound)
                .await
                .map_err(|_| {
                    Error::MessageSetupFailure("could not create monitor messenger".into())
                })?
                .0,
            service::message::Audience::Broadcast,
        );
        // Bring up each monitor.
        for monitor in &self.monitors {
            let (_, monitor_receptor) =
                self.delegate.create(MessengerType::Unbound).await.map_err(|_| {
                    Error::MessageSetupFailure("could not create monitor receptor".into())
                })?;
            monitor(base_monitor::Context { receptor: monitor_receptor })
                .await
                .map_err(|_| Error::MonitorSetupFailure("could not create monitor".into()))?
        }
        Ok(monitor_messenger)
    }
pub async fn start_monitoring ( & self ) -> Result < service :: message :: TargetedMessenger , Error > { // Create unbound, broadcasting messenger to send messages to the monitors. let monitor_messenger = service :: message :: TargetedMessenger :: new ( self . delegate . create ( MessengerType :: Unbound ) . await . map_err ( | _ | { Error :: MessageSetupFailure ( " " . into ( ) ) } ) ? . 0 , service :: message :: Audience :: Broadcast , ) ; // Bring up each monitor. for monitor in & self . monitors { let ( _ , monitor_receptor ) = self . delegate . create ( MessengerType :: Unbound ) . await . map_err ( | _ | { Error :: MessageSetupFailure ( " " . into ( ) ) } ) ? ; monitor ( base_monitor :: Context { receptor : monitor_receptor } ) . await . map_err ( | _ | Error :: MonitorSetupFailure ( " " . into ( ) ) ) ? } Ok ( monitor_messenger ) }
Starts up environment monitors and returns a TargetedMessenger that
broadcasts to all monitors.
Starts up environment monitors and returns a TargetedMessenger that broadcasts to all monitors .
&self