Broker Coroutines
Interface representing a coroutine-based message broker that supports sending, receiving, and responding to messages.
Functions
Link copied to clipboard
Initializes the message broker, performing any necessary setup or initialization tasks.
Link copied to clipboard
Registers a handler to listen for messages of a specific type.
Link copied to clipboard
inline suspend fun <T : Any> BrokerCoroutines.listen(noinline handler: suspend (T) -> Unit): AutoCloseable
Registers a handler to listen for messages of a specific type.
Link copied to clipboard
abstract suspend fun <R : Any> request(message: Any, responseType: KClass<R>, vararg targets: Target): R
abstract suspend fun <R : Any> request(message: Any, responseType: KClass<R>, targets: Collection<Target>): R
Sends a request and awaits a response using the default timeout.
abstract suspend fun <R : Any> request(message: Any, responseType: KClass<R>, timeout: Duration, vararg targets: Target): R
abstract suspend fun <R : Any> request(message: Any, responseType: KClass<R>, timeout: Duration, targets: Collection<Target>): R
Sends a request and awaits a response within a specified timeout.
Link copied to clipboard
abstract suspend fun <T : Any, Y : Any> respond(responder: ResponderCoroutines<T, Y>): AutoCloseable
Registers a responder to handle incoming messages of a specific type and produce a response.
abstract suspend fun <T : Any, Y : Any> respond(type: KClass<T>, responder: suspend (T) -> Y?): AutoCloseable
Registers a function to respond to incoming messages of a specific type.
Link copied to clipboard
inline suspend fun <T : Any, R : Any> BrokerCoroutines.respond(noinline handler: suspend (T) -> R?): AutoCloseable
Registers a function to respond to incoming messages of a specific type.