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