fn handle(&mut self, msg: Invocation, _ctx: &mut Context<Self>) -> Self::Result {
        if let Err(e) = auth::authorize_invocation(
            &msg,
            self.authorizer.as_ref().unwrap().clone(),
            &self.claims_cache,
        ) {
            error!("Authorization failure: {}", e);
            println!("Authorization failure: {}", e);
            return Box::pin(
                async move {
                    InvocationResponse::error(&msg, &format!("Authorization denied: {}", e))
                }.into_actor(self)
            );
        }
        match self.subscribers.get(&msg.target) {
            Some(target) => Box::pin(target.send(msg.clone()).into_actor(self).map(
                move |res, act, _ctx| {
                    println!("Bus invocation - {:?}", res);
                    if let Ok(r) = res {
                        println!("success");
                        r
                    } else {
                        println!("failure");
                        InvocationResponse::error(
                            &msg,
                            "Mailbox error attempting to perform invocation",
                        )
                    }
                },
            )),
            None => {
                println!("deferring to lattice");
                if let Some(ref l) = self.provider {
                    let res = super::utils::do_rpc(l, &msg);
                    Box::pin(async move { res }.into_actor(self))
                } else {
                    Box::pin(
                        async move {
                            InvocationResponse::error(
                                &msg,
                                &format!("No matching target found on bus {:?}", &msg.target),
                            )
                        }
                        .into_actor(self),
                    )
                }
            }
        }
    }
/// Handle an invocation from any source to any target. If there is a local subscriber
/// then the invocation will be delivered directly to that subscriber. If the subscriber
/// is not local, _and_ there is a lattice provider configured, then the bus will attempt
/// to satisfy that call via RPC over lattice.
Handle an invocation from any source to any target. If there is a local subscriber
then the invocation will be delivered directly to that subscriber. If the subscriber
is not local, _and_ there is a lattice provider configured, then the bus will attempt
to satisfy that call via RPC over lattice.
Handle an invocation from any source to any target . If there is a local subscriber then the invocation will be delivered directly to that subscriber . If the subscriber is not local _and_ there is a lattice provider configured then the bus will attempt to satisfy that call via RPC over lattice .
fn handle(&mut self, msg: Invocation, _ctx: &mut Context<Self>) -> Self::Result {
        if let Err(e) = auth::authorize_invocation(
            &msg,
            self.authorizer.as_ref().unwrap().clone(),
            &self.claims_cache,
        ) {
            error!("Authorization failure: {}", e);
            println!("Authorization failure: {}", e);
            return Box::pin(
                async move {
                    InvocationResponse::error(&msg, &format!("Authorization denied: {}", e))
                }.into_actor(self)
            );
        }
        match self.subscribers.get(&msg.target) {
            Some(target) => Box::pin(target.send(msg.clone()).into_actor(self).map(
                move |res, act, _ctx| {
                    println!("Bus invocation - {:?}", res);
                    if let Ok(r) = res {
                        println!("success");
                        r
                    } else {
                        println!("failure");
                        InvocationResponse::error(
                            &msg,
                            "Mailbox error attempting to perform invocation",
                        )
                    }
                },
            )),
            None => {
                println!("deferring to lattice");
                if let Some(ref l) = self.provider {
                    let res = super::utils::do_rpc(l, &msg);
                    Box::pin(async move { res }.into_actor(self))
                } else {
                    Box::pin(
                        async move {
                            InvocationResponse::error(
                                &msg,
                                &format!("No matching target found on bus {:?}", &msg.target),
                            )
                        }
                        .into_actor(self),
                    )
                }
            }
        }
    }
fn handle ( & mut self , msg : Invocation , _ctx : & mut Context < Self > ) -> Self :: Result { if let Err ( e ) = auth :: authorize_invocation ( & msg , self . authorizer . as_ref ( ) . unwrap ( ) . clone ( ) , & self . claims_cache , ) { error ! ( " " e ) ; println ! ( " " e ) ; return Box :: pin ( async move { InvocationResponse :: error ( & msg , & format ! ( " " e ) ) } . into_actor ( self ) ) ; } match self . subscribers . get ( & msg . target ) { Some ( target ) => Box :: pin ( target . send ( msg . clone ( ) ) . into_actor ( self ) . map ( move | res , act , _ctx | { println ! ( " " res ) ; if let Ok ( r ) = res { println ! ( " " ) ; r } else { println ! ( " " ) ; InvocationResponse :: error ( & msg , " " , ) } } , ) ) , None => { println ! ( " " ) ; if let Some ( ref l ) = self . provider { let res = super :: utils :: do_rpc ( l , & msg ) ; Box :: pin ( async move { res } . into_actor ( self ) ) } else { Box :: pin ( async move { InvocationResponse :: error ( & msg , & format ! ( " " msg target ) , ) } . into_actor ( self ) , ) } } } }
Handle an invocation from any source to any target.
Handle an invocation from any source to any target .
&mut self
msg
Invocation
_ctx
&mut Context<Self>
&mut self
msg
Invocation
_ctx
&mut Context<Self>