select
Like kotlinx.coroutines.selects.select, but for Awaitable
val ctx = restateContext()
val callAwaitable = ctx.callAsync(GreeterGrpcKt.greetMethod, greetingRequest { name = "Francesco" })
val timeout = ctx.timer(10.seconds)
val result = select {
callAwaitable.onAwait { it.message }
timeout.onAwait { throw TimeoutException() }
}
Content copied to clipboard