pub async fn message_bus_run(
    server: &str,
    node: &str,
    grpc_endpoint: &str,
) -> Result<(), ()> {
    let (sender, receiver) = mpsc::channel::<()>(1);
    {
        let mut sender_maybe = SENDER.lock().unwrap();
        if sender_maybe.is_some() {
            panic!("Double initialization of message bus");
        }
        *sender_maybe = Some(sender);
    }
    let mut mbus = MessageBus::new(server, node, grpc_endpoint);
    match mbus.run(receiver).await {
        Err(err) => {
            error!("{}", err);
            Err(())
        }
        Ok(_) => Ok(()),
    }
}
/// Connect to the NATS server and start emitting periodic register messages.
/// Runs until the message_bus_stop() is called.
Connect to the NATS server and start emitting periodic register messages.
Runs until the message_bus_stop() is called.
Connect to the NATS server and start emitting periodic register messages . Runs until the message_bus_stop () is called .
pub async fn message_bus_run(
    server: &str,
    node: &str,
    grpc_endpoint: &str,
) -> Result<(), ()> {
    let (sender, receiver) = mpsc::channel::<()>(1);
    {
        let mut sender_maybe = SENDER.lock().unwrap();
        if sender_maybe.is_some() {
            panic!("Double initialization of message bus");
        }
        *sender_maybe = Some(sender);
    }
    let mut mbus = MessageBus::new(server, node, grpc_endpoint);
    match mbus.run(receiver).await {
        Err(err) => {
            error!("{}", err);
            Err(())
        }
        Ok(_) => Ok(()),
    }
}
pub async fn message_bus_run ( server : & str , node : & str , grpc_endpoint : & str , ) -> Result < ( ) , ( ) > { let ( sender , receiver ) = mpsc :: channel :: < ( ) > ( 1 ) ; { let mut sender_maybe = SENDER . lock ( ) . unwrap ( ) ; if sender_maybe . is_some ( ) { panic ! ( " " ) ; } * sender_maybe = Some ( sender ) ; } let mut mbus = MessageBus :: new ( server , node , grpc_endpoint ) ; match mbus . run ( receiver ) . await { Err ( err ) => { error ! ( " " err ) ; Err ( ( ) ) } Ok ( _ ) => Ok ( ( ) ) , } }
Connect to the NATS server and start emitting periodic register messages.
Connect to the NATS server and start emitting periodic register messages .
server
&str
node
&str
grpc_endpoint
&str
server
&str
node
&str
grpc_endpoint
&str