messageHandler

fun <T : Any> FusClient.Builder<*, *>.messageHandler(topic: Topic<T>, errorHandler: (Throwable) -> Unit = {}, handle: suspend (message: T) -> Unit)

Registers a callback that runs asynchronously when the step identified by topic occurs inside the FusClient. Message handlers can run concurrently, so shared resources must be thread-safe.

Parameters

topic

Identifier of the step to listen for. For example, RAW_EVENT_TOPIC for whenever an event is queued.

errorHandler

Called if the handler throws an exception (optional, defaults to ignoring errors)

handle

The callback invoked when the step occurs, receiving case-specific data

See also