RpcManager

class RpcManager<R>(loggerFactory: Logger.Factory, timeout: Duration)

Manages Remote Procedure Call (RPC) communication within the system.

Provides support for making requests, handling responses, and managing active communication channels with built-in timeout capabilities. This class also ensures proper handling of opened channels by closing or removing them to prevent resource leaks.

Parameters

R

The type of response that the RPC expects.

loggerFactory

Factory for creating a logger instance for structured logging.

timeout

The duration to wait for a request to complete before timing out.

Constructors

Link copied to clipboard
constructor(loggerFactory: Logger.Factory, timeout: Duration)

Properties

Link copied to clipboard
val log: Logger

Functions

Link copied to clipboard
suspend fun response(reqId: Long, res: R)

Handles sending a response to a specific request and manages potential timeouts or errors.