pub struct InMemoryRpcClient { /* private fields */ }
Expand description
An RpcClient
which keeps all information about pending requests in memory.
The client requires an implementations of UTransport
for sending RPC Request messages
to the service implementation and receiving its RPC Response messages.
During startup the client registers a generic UListener
with the transport
for receiving all kinds of messages with a sink address matching the client. The listener
maintains an in-memory mapping of (pending) request IDs to response message handlers.
When an RPC call
is made, an RPC Request message is sent to the service
implementation and a response handler is created and registered with the listener.
When an RPC Response message arrives from the service, the corresponding handler is being looked
up and invoked.
Implementations§
Source§impl InMemoryRpcClient
impl InMemoryRpcClient
Sourcepub async fn new(
transport: Arc<dyn UTransport>,
uri_provider: Arc<dyn LocalUriProvider>,
) -> Result<Self, RegistrationError>
pub async fn new( transport: Arc<dyn UTransport>, uri_provider: Arc<dyn LocalUriProvider>, ) -> Result<Self, RegistrationError>
Creates a new RPC client for a given transport.
§Arguments
transport
- The uProtocol Transport Layer implementation to use for invoking service operations.uri_provider
- The helper for creating URIs that represent local resources.
§Errors
Returns an error if the generic RPC Response listener could not be registered with the given transport.