Function ractor::rpc::call_and_forward

source ·
pub fn call_and_forward<TMessage, TForwardMessage, TReply, TMsgBuilder, FwdMapFn>(
    actor: &ActorCell,
    msg_builder: TMsgBuilder,
    response_forward: ActorCell,
    forward_mapping: FwdMapFn,
    timeout_option: Option<Duration>
) -> Result<JoinHandle<CallResult<Result<(), MessagingErr<TForwardMessage>>>>, MessagingErr<TMessage>>
where TMessage: Message, TReply: Send + 'static, TMsgBuilder: FnOnce(RpcReplyPort<TReply>) -> TMessage, TForwardMessage: Message, FwdMapFn: FnOnce(TReply) -> TForwardMessage + Send + 'static,
Expand description

Send a message asynchronously to another actor, waiting in a new task for the reply and then forwarding the reply to a followup-actor. If this CallResult from the first actor is not success, the forward is not sent.

  • actor - A reference to the ActorCell to communicate with
  • msg_builder - The FnOnce to construct the message
  • response_forward - The ActorCell to forward the message to
  • forward_mapping - The FnOnce which maps the response from the actor ActorCell’s reply message type to the response_forward ActorCell’s message type
  • timeout_option - An optional Duration which represents the amount of time until the operation times out

Returns: A [JoinHandle<CallResult<()>>] which can be awaited to see if the forward was successful or ignored