toVirtualObject

@ApiStatus.Experimental
inline fun <SVC : Any> toVirtualObject(key: String): KRequestBuilder<SVC>

Create a builder for invoking a Restate virtual object from within a handler.

Example usage:

@Handler
suspend fun myHandler(): Long {
val result = toVirtualObject<Counter>("my-counter")
.request { add(1) }
.call()
.await()
return result
}

Return

a builder for creating typed requests

Parameters

SVC

the virtual object class annotated with @VirtualObject

key

the key identifying the specific virtual object instance