[][src]Trait splinter::service::ServiceNetworkSender

pub trait ServiceNetworkSender: Send {
    fn send(
        &self,
        recipient: &str,
        message: &[u8]
    ) -> Result<(), ServiceSendError>;
fn send_and_await(
        &self,
        recipient: &str,
        message: &[u8]
    ) -> Result<Vec<u8>, ServiceSendError>;
fn reply(
        &self,
        message_origin: &ServiceMessageContext,
        message: &[u8]
    ) -> Result<(), ServiceSendError>;
fn clone_box(&self) -> Box<dyn ServiceNetworkSender>; }

The ServiceNetworkSender trait allows a service to send its own messages, such as replies to the original message or forwarding the message to other services on the same circuit. It does not expose the circuit information directly.

Required methods

fn send(&self, recipient: &str, message: &[u8]) -> Result<(), ServiceSendError>

Send the message bytes to the given recipient (another service)

fn send_and_await(
    &self,
    recipient: &str,
    message: &[u8]
) -> Result<Vec<u8>, ServiceSendError>

Send the message bytes to the given recipient (another service) and await the reply. This function blocks until the reply is returned.

fn reply(
    &self,
    message_origin: &ServiceMessageContext,
    message: &[u8]
) -> Result<(), ServiceSendError>

Send the message bytes back to the origin specified in the given message context.

fn clone_box(&self) -> Box<dyn ServiceNetworkSender>

Clone this instance into Boxed, dynamic trait

Loading content...

Implementors

Loading content...